Re: Does SOLR Allow q= (A or B) AND (C or D)?
http://lucene.472066.n3.nabble.com/file/n859016/qa.writepublic.com.xml qa.writepublic.com.xml I modified your schema.xml You need to restart jetty and re-index you documents. After that in the solr admin page, if you search prefix_full:george clo prefix_token:(george clo) you will get your documents for to use in suggestion. After trying this, can you tell us if this is what you were looking for? -- View this message in context: http://lucene.472066.n3.nabble.com/Does-SOLR-Allow-q-A-or-B-AND-C-or-D-tp849703p859016.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Does SOLR Allow q= (A or B) AND (C or D)?
--- On Fri, 5/28/10, efr...@gmail.com efr...@gmail.com wrote: From: efr...@gmail.com efr...@gmail.com Subject: Re: Does SOLR Allow q= (A or B) AND (C or D)? To: solr-user@lucene.apache.org Date: Friday, May 28, 2010, 4:42 AM Hi Ahmet, Thanks again for the feedback. We will be searching several fields of each object in the index (title, description, tags). The matches on keywords need to be in any of these fields and there will be no different weights. Okey after investigating your example website, i think i understand you now. As a suggestion you are going to display documents, not a particular field, or keywords. You can do it with my solution. Create two additional fields with the types i wrote. Copy your title, desc and tag fields into these fields. Execute the query - on these two field - as the user types. You will see the same results with your example website. Just don't forget to use quotes for the field that uses keyword tokenizer. And the () for the other one. Also default operator OR is required. When the user is typing the query tap water, your query will be q=f1:tap wate f2:(tap wate) just before the last key stroke.
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Hi Ahmad, Thanks for this. So do we need this:*defType=luceneq.op=ORfl=Title* at the end? Also, I'm guessing we will need to install EdgeNGramFilterFactory? Here are the analyzers / filters we currently are using (just the default stuff): *Index Analyzer: *org.apache.solr.analysis.TokenizerChain Detailshttp://qa.writepublic.com:8983/solr/admin/schema.jsp# *Tokenizer Class: * org.apache.solr.analysis.WhitespaceTokenizerFactory *Filters: * 1. org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt ignoreCase: true enablePositionIncrements: true } 2. org.apache.solr.analysis.WordDelimiterFilterFactory args:{splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 1 generateWordParts: 1 catenateAll: 0 catenateNumbers: 1 } 3. org.apache.solr.analysis.LowerCaseFilterFactory args:{} 4. org.apache.solr.analysis.EnglishPorterFilterFactory args:{protected: protwords.txt } 5. org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{} I am not seeing these from your example in a prev email: tokenizer class=solr.WhitespaceTokenizerFactory/ filter class=solr.LowerCaseFilterFactory/ tokenizer class=solr.KeywordTokenizerFactory/ filter class=solr.TrimFilterFactory/ filter class=solr.LowerCaseFilterFactory/ Perhaps they were not necessary and just a part of your example? Again, thanks for your help. thanks Brad On Fri, May 28, 2010 at 3:43 PM, Ahmet Arslan iori...@yahoo.com wrote: --- On Fri, 5/28/10, efr...@gmail.com efr...@gmail.com wrote: From: efr...@gmail.com efr...@gmail.com Subject: Re: Does SOLR Allow q= (A or B) AND (C or D)? To: solr-user@lucene.apache.org Date: Friday, May 28, 2010, 4:42 AM Hi Ahmet, Thanks again for the feedback. We will be searching several fields of each object in the index (title, description, tags). The matches on keywords need to be in any of these fields and there will be no different weights. Okey after investigating your example website, i think i understand you now. As a suggestion you are going to display documents, not a particular field, or keywords. You can do it with my solution. Create two additional fields with the types i wrote. Copy your title, desc and tag fields into these fields. Execute the query - on these two field - as the user types. You will see the same results with your example website. Just don't forget to use quotes for the field that uses keyword tokenizer. And the () for the other one. Also default operator OR is required. When the user is typing the query tap water, your query will be q=f1:tap wate f2:(tap wate) just before the last key stroke.
Re: Does SOLR Allow q= (A or B) AND (C or D)?
On Thu, May 27, 2010 at 5:34 PM, efr...@gmail.com efr...@gmail.com wrote: Hi all, I have a query need that requires multiple OR conditions, and, there must be a match in each condition for the query to provide a result. The search would be * (A or B) AND (C or D)* and the only valid results it could turn up are: A B (sorry meant A D) A C B C B D Can anyone provide guidance as to how to implement this in the query string? thanks Brad
Re: Does SOLR Allow q= (A or B) AND (C or D)?
I have a query need that requires multiple OR conditions, and, there must be a match in each condition for the query to provide a result. The search would be * (A or B) AND (C or D)* and the only valid results it could turn up are: A B A C B C B D Can anyone provide guidance as to how to implement this in the query string? It should be something like : q=+(A B) +(C D)q.op=OR
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Thank you. That seems to be working well, except when I included a wild card for any of the terms, the wildcard term isn't being found out. My searches are actually: q=+(A A*) +(C C*)q.op=OR When I do a regular search on A* or C* I get matches but not in the context of the above query. The ability to use wildcards seems to get lost. This is all for the purposes of a live search in which we return matches as the user types, thus the wildcard. A and C represent two different terms a user has typed in the search box (where we are providing the live-search results). thanks Brad On Thu, May 27, 2010 at 5:47 PM, Ahmet Arslan iori...@yahoo.com wrote: I have a query need that requires multiple OR conditions, and, there must be a match in each condition for the query to provide a result. The search would be * (A or B) AND (C or D)* and the only valid results it could turn up are: A B A C B C B D Can anyone provide guidance as to how to implement this in the query string? It should be something like : q=+(A B) +(C D)q.op=OR
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Thank you. That seems to be working well, except when I included a wild card for any of the terms, the wildcard term isn't being found out. My searches are actually: q=+(A A*) +(C C*)q.op=OR When I do a regular search on A* or C* I get matches but not in the context of the above query. The ability to use wildcards seems to get lost. This is all for the purposes of a live search in which we return matches as the user types, thus the wildcard. A and C represent two different terms a user has typed in the search box (where we are providing the live-search results). Looks like you are looking for auto-suggest/complete feature. As the user types something there will be ajax suggestions right? Queries A* or C* are not sorted by score/relevance. Can you explain in more detail what do you mean by search on A* or C* I get matches but not in the context of the above query
Re: Does SOLR Allow q= (A or B) AND (C or D)?
You can get a lot of mileage out of the admin analysis page and the full interface page, especially by turning on the debug option on the admin full interface page. It takes a bit of practice to read the debug output, but it's really, really, really worth it Best Erick On Thu, May 27, 2010 at 6:37 PM, efr...@gmail.com efr...@gmail.com wrote: Thank you. That seems to be working well, except when I included a wild card for any of the terms, the wildcard term isn't being found out. My searches are actually: q=+(A A*) +(C C*)q.op=OR When I do a regular search on A* or C* I get matches but not in the context of the above query. The ability to use wildcards seems to get lost. This is all for the purposes of a live search in which we return matches as the user types, thus the wildcard. A and C represent two different terms a user has typed in the search box (where we are providing the live-search results). thanks Brad On Thu, May 27, 2010 at 5:47 PM, Ahmet Arslan iori...@yahoo.com wrote: I have a query need that requires multiple OR conditions, and, there must be a match in each condition for the query to provide a result. The search would be * (A or B) AND (C or D)* and the only valid results it could turn up are: A B A C B C B D Can anyone provide guidance as to how to implement this in the query string? It should be something like : q=+(A B) +(C D)q.op=OR
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Hi Ahmet, Thanks for the response again. The best way I could illustrate our live search feature is an example implementation: http://www.krop.com/ Notice when you search the word senior in the keywords field, the results filter down to just the job postings with that word in it. So it's not the same as an autocomplete type feature where as the user types in the search input box, their input is completed. We are just focusing on providing results with each key stroke. If the user types Ca, we will return anything with Cat in it. Thus we need the wildcard. As of now we send a query to solr of Ca*. However, solr can struggle with wildcards where it won't return a match on a word if there is a wildcard at the end of a fully-typed word. You have to leave off the last letter of that word and an asterisk to match it. We're attempting to do an OR search of the term OR term* anytime a user enters a term. Our need mix these or searches with an AND command is because if a user types two words, we are requiring both words be in the result to have a match. Your suggestion as how to do this worked beautifully, except for the fact that it didn't seem to be able to find wildcarded terms when indeed it should have. thanks Brad On Thu, May 27, 2010 at 6:57 PM, Ahmet Arslan iori...@yahoo.com wrote: Thank you. That seems to be working well, except when I included a wild card for any of the terms, the wildcard term isn't being found out. My searches are actually: q=+(A A*) +(C C*)q.op=OR When I do a regular search on A* or C* I get matches but not in the context of the above query. The ability to use wildcards seems to get lost. This is all for the purposes of a live search in which we return matches as the user types, thus the wildcard. A and C represent two different terms a user has typed in the search box (where we are providing the live-search results). Looks like you are looking for auto-suggest/complete feature. As the user types something there will be ajax suggestions right? Queries A* or C* are not sorted by score/relevance. Can you explain in more detail what do you mean by search on A* or C* I get matches but not in the context of the above query
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Thanks for the response again. The best way I could illustrate our live search feature is an example implementation: http://www.krop.com/ Notice when you search the word senior in the keywords field, the results filter down to just the job postings with that word in it. So it's not the same as an autocomplete type feature where as the user types in the search input box, their input is completed. We are just focusing on providing results with each key stroke. If the user types Ca, we will return anything with Cat in it. Thus we need the wildcard. As of now we send a query to solr of Ca*. However, solr can struggle with wildcards where it won't return a match on a word if there is a wildcard at the end of a fully-typed word. You have to leave off the last letter of that word and an asterisk to match it. Okey i was referring the same. Each keystroke will return results. There are many way to achieve this. Are you going to suggest from index/documents or from coming queries? I mean do you have a separate index to capture most popular searches? We're attempting to do an OR search of the term OR term* anytime a user enters a term. term* is super set of term so you need to include/OR term in your query. Our need mix these or searches with an AND command is because if a user types two words, we are requiring both words be in the result to have a match. generally two ways: using wildcards on shingles (ShingleFilterFactory) or using EdgeNGramFilterFactory can deal two or more words Do you mind the order of words use types? Suggestions should come in order that the user types?
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Thanks, I found full interface :) On Thu, May 27, 2010 at 7:12 PM, Erick Erickson erickerick...@gmail.comwrote: You can get a lot of mileage out of the admin analysis page and the full interface page, especially by turning on the debug option on the admin full interface page. It takes a bit of practice to read the debug output, but it's really, really, really worth it Best Erick On Thu, May 27, 2010 at 6:37 PM, efr...@gmail.com efr...@gmail.com wrote: Thank you. That seems to be working well, except when I included a wild card for any of the terms, the wildcard term isn't being found out. My searches are actually: q=+(A A*) +(C C*)q.op=OR When I do a regular search on A* or C* I get matches but not in the context of the above query. The ability to use wildcards seems to get lost. This is all for the purposes of a live search in which we return matches as the user types, thus the wildcard. A and C represent two different terms a user has typed in the search box (where we are providing the live-search results). thanks Brad On Thu, May 27, 2010 at 5:47 PM, Ahmet Arslan iori...@yahoo.com wrote: I have a query need that requires multiple OR conditions, and, there must be a match in each condition for the query to provide a result. The search would be * (A or B) AND (C or D)* and the only valid results it could turn up are: A B A C B C B D Can anyone provide guidance as to how to implement this in the query string? It should be something like : q=+(A B) +(C D)q.op=OR
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Responses in blue On Thu, May 27, 2010 at 7:32 PM, Ahmet Arslan iori...@yahoo.com wrote: Thanks for the response again. The best way I could illustrate our live search feature is an example implementation: http://www.krop.com/ Notice when you search the word senior in the keywords field, the results filter down to just the job postings with that word in it. So it's not the same as an autocomplete type feature where as the user types in the search input box, their input is completed. We are just focusing on providing results with each key stroke. If the user types Ca, we will return anything with Cat in it. Thus we need the wildcard. As of now we send a query to solr of Ca*. However, solr can struggle with wildcards where it won't return a match on a word if there is a wildcard at the end of a fully-typed word. You have to leave off the last letter of that word and an asterisk to match it. Okey i was referring the same. Each keystroke will return results. There are many way to achieve this. Are you going to suggest from index/documents or from coming queries? I mean do you have a separate index to capture most popular searches? We do not have a seperate index to capture most popular searches (is that coming queries?) We're attempting to do an OR search of the term OR term* anytime a user enters a term. term* is super set of term so you need to include/OR term in your query. Thanks... Our need mix these or searches with an AND command is because if a user types two words, we are requiring both words be in the result to have a match. generally two ways: using wildcards on shingles (ShingleFilterFactory) or using EdgeNGramFilterFactory can deal two or more words Do you mind the order of words use types? Suggestions should come in order that the user types? We don't mind the order of terms. We basically are sorting by two variables that are independent of relevency. So I would assume the order doesn't matter... we just need to make sure any results we filter down to (as you saw in the krop.com example) contain the words the user has typed.
Re: Does SOLR Allow q= (A or B) AND (C or D)?
We don't mind the order of terms. We basically are sorting by two variables that are independent of relevency. So I would assume the order doesn't matter... we just need to make sure any results we filter down to (as you saw in the krop.com example) contain the words the user has typed. Lets say you have short title field and you are going to give suggest/autocomplete using this field from index and order is not important. But in this ca fieldType name=prefix_full class=solr.TextField positionIncrementGap=1 analyzer type=index tokenizer class=solr.KeywordTokenizerFactory/ filter class=solr.TrimFilterFactory/ filter class=solr.LowerCaseFilterFactory/ filter class=solr.EdgeNGramFilterFactory minGramSize=1 maxGramSize=20/ /analyzer analyzer type=query tokenizer class=solr.KeywordTokenizerFactory/ filter class=solr.LowerCaseFilterFactory/ /analyzer /fieldType fieldType name=prefix_token class=solr.TextField positionIncrementGap=1 analyzer type=index tokenizer class=solr.WhitespaceTokenizerFactory/ filter class=solr.LowerCaseFilterFactory/ filter class=solr.EdgeNGramFilterFactory minGramSize=1 maxGramSize=20/ /analyzer You can use these two fields, populate them from your short title field copyField source=Title dest=titlePrefix/ copyField source=Title dest=titlePrefixFull/ and use normal query, (not wildcard) as the user types words q=titlePrefix:(term1 te) titlePrefixFull:term1 tedefType=luceneq.op=ORfl=Title will return you suggestions. Does this satisfy your needs? In this case you are suggesting whole title field. Or do you want to use ShingleFilterFactory with wildcard query?
Re: Does SOLR Allow q= (A or B) AND (C or D)?
Hi Ahmet, Thanks again for the feedback. We will be searching several fields of each object in the index (title, description, tags). The matches on keywords need to be in any of these fields and there will be no different weights. Does this affect your solution? I'm trying to understand it as best I can as I didn't set up our solr nor am I directly managing its implementation. thanks Brad On Thu, May 27, 2010 at 8:12 PM, Ahmet Arslan iori...@yahoo.com wrote: We don't mind the order of terms. We basically are sorting by two variables that are independent of relevency. So I would assume the order doesn't matter... we just need to make sure any results we filter down to (as you saw in the krop.com example) contain the words the user has typed. Lets say you have short title field and you are going to give suggest/autocomplete using this field from index and order is not important. But in this ca fieldType name=prefix_full class=solr.TextField positionIncrementGap=1 analyzer type=index tokenizer class=solr.KeywordTokenizerFactory/ filter class=solr.TrimFilterFactory/ filter class=solr.LowerCaseFilterFactory/ filter class=solr.EdgeNGramFilterFactory minGramSize=1 maxGramSize=20/ /analyzer analyzer type=query tokenizer class=solr.KeywordTokenizerFactory/ filter class=solr.LowerCaseFilterFactory/ /analyzer /fieldType fieldType name=prefix_token class=solr.TextField positionIncrementGap=1 analyzer type=index tokenizer class=solr.WhitespaceTokenizerFactory/ filter class=solr.LowerCaseFilterFactory/ filter class=solr.EdgeNGramFilterFactory minGramSize=1 maxGramSize=20/ /analyzer You can use these two fields, populate them from your short title field copyField source=Title dest=titlePrefix/ copyField source=Title dest=titlePrefixFull/ and use normal query, (not wildcard) as the user types words q=titlePrefix:(term1 te) titlePrefixFull:term1 tedefType=luceneq.op=ORfl=Title will return you suggestions. Does this satisfy your needs? In this case you are suggesting whole title field. Or do you want to use ShingleFilterFactory with wildcard query?