I would like to add autocomplete to my tagging functionality.
Some questions:
-
How do I create a list of autocomplete suggestions that include both matches between the prefix and the string. For example, if the user Type "auto", then the autocomplete suggestions should include words like "autocomplete" and "build automation".
-
I use a comma (",") as a multi-word tag and a divider for the tag. So when the usage hits the space bar, then he is still typing the same tag, but when he kills the comma key, he is starting a new tag how can I do this?
I am using Django, jQuery, MySQL, and Solr. What is the best way to implement the above 2 features?
I'm asking you about the most effective 'and it really is well There are two issues to be aware of:
- Highlighting in the result list summary is not working, and the suggested solution does not work in this particular case.
- If your documents have long titles and they are shortened when displayed, then there is a chance that you will meet on the prefix of the word that is not appearing.
- And in the future version, I finally want to give the word for the beginning of the title on a slightly higher weight of words. This will be a way to reduce the previous item.
Like in the previous answer, I will start with the same article written above, but you want Edge NGRM analyzer. What you add will also have to do whotspace tokenization.
And then you will make these changes in your schema.xml file. This example assumes that you already have a field labeled "Title", and that is what you also want to display. I make another area, which is used only for auto completion full match.
Step 1: Define the Edge NGram Text Field Type
& lt; Types & gt; & Lt ;! - ... other types ... - & gt; & Lt ;! - Suppose you already have it - & gt; & Lt; FieldType name = "text" class = "solr.TextField" statusIncantgap = "100" & gt; ... Normal text definition ... & lt; / Field type & gt; & Lt ;! - Adding it - & gt; & Lt; FieldType name = "prefix_edge_text" class = "solr.TextField" statusIncantgap = "100" & gt; & Lt; Analyzer Type = "Index" & gt; & Lt; Tokenizer class = "solr.WhitespaceTokenizerFactory" /> & Lt; Filter class = "solr.LowerCaseFilterFactory" /> & Lt ;! - Use to not enable - for now true = "true" - & gt; & Lt; Filter class = "solr.StopFilterFactory" = "stopwords.txt" /> & Lt; Filter class = "solr.EgegeramFilterFactory" minGramSize = "1" maxGramSize = "25" /> & Lt; / Analyzer & gt; & Lt; Analyzer type = "query" & gt; & Lt; Tokenizer class = "solr.WhitespaceTokenizerFactory" /> & Lt; Filter class = "solr.LowerCaseFilterFactory" /> & Lt ;! - No need to make corners - & gt; & Lt ;! - Do not want to stop here - & gt; & Lt; / Analyzer & gt; & Lt; / FieldType & gt; & Lt; / Type & gt;
Step 2: Set new field
& lt; Field & gt; & Lt ;! - ... other fields ... - & gt; & Lt ;! - Suppose you already have it - & gt; & Lt; Field name = "title" type = "text" indexed = "true" stored = "true" multidimensional = "true" /> & lt ;! - Adding it - & gt; & Lt; Field name = "prefix_chitel" type = "prefix_ge_text" index = "true" stored = "true" multidimensional = "true" /> & Lt; / Regions & gt;
Step 3: Copy the contents of the title to the prefix field while indexing
It is too much schema to remember:
- When you do regular search, you can still get regular title Do searches against the field.
- Search against prefix_title when you are done autocomplete.
Comments
Post a Comment