Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread cleonard
I have a search text field that contains all the search terms.  I'm taking
user input and breaking it up into tokens of term1, term2, term3, etc and
the then submitting to Dismax.  

q=search_text:term1* AND search_text:term2* AND search_text:term3*

This works great.  The problem is when a user mistypes a term.  Then nothing
is found.  This is not good. 

To address this I'm now doing OR instead

q=search_text:term1* OR search_text:term2* OR search_text:term3*

Now a mistyped term is no problem.  I still get results.  The issue now is
that I get too many results back.  What I want is something that effectively
does an AND if a term is matched, but does an OR when a term is not found. 
To say it a differnt way -- If a term is found I only want results that
contain that term.  

I've tried many different boolean expressions to no success.  I've spent
hours searching for a solution, but so far I've not found the answer.  I
feel that there is a simple solution, so I'm hoping that someone can
enlighten me here.






--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread Shawn Heisey

On 9/21/2012 11:22 AM, cleonard wrote:

Now a mistyped term is no problem.  I still get results.  The issue now is
that I get too many results back.  What I want is something that effectively
does an AND if a term is matched, but does an OR when a term is not found.
To say it a differnt way -- If a term is found I only want results that
contain that term.


It won't be precisely what you describe, but you may want to switch to 
edismax and employ the mm parameter.


http://wiki.apache.org/solr/ExtendedDisMax

http://wiki.apache.org/solr/ExtendedDisMax#mm_.28Minimum_.27Should.27_Match.29

Thanks,
Shawn



Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread cleonard
I've played with the mm parameter quite a bit.  It does sort of do what I
need if I do multiple queries decreasing the mm parameter with each call. 
However, I'm doing this for a web form auto complete or suggester so I
really want to make this happen in a single request if at all possible.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451p4009460.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread Otis Gospodnetic
Hi,

I'm curious... why do you issue multiple queries for autocomplete purposes?
Have you tried using Suggester?  May also want
http://sematext.com/products/autocomplete/index.html which works
nicely with Solr.

Otis
Search Analytics - http://sematext.com/search-analytics/index.html
Performance Monitoring - http://sematext.com/spm/index.html


On Fri, Sep 21, 2012 at 2:50 PM, cleonard cleon...@whisolutions.com wrote:
 I've played with the mm parameter quite a bit.  It does sort of do what I
 need if I do multiple queries decreasing the mm parameter with each call.
 However, I'm doing this for a web form auto complete or suggester so I
 really want to make this happen in a single request if at all possible.



 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451p4009460.html
 Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread cleonard
Otis Gospodnetic-5 wrote
 Hi,
 
 I'm curious... why do you issue multiple queries for autocomplete
 purposes?
 Have you tried using Suggester?  May also want
 http://sematext.com/products/autocomplete/index.html which works
 nicely with Solr.
 
 Otis
 Search Analytics - http://sematext.com/search-analytics/index.html
 Performance Monitoring - http://sematext.com/spm/index.html

I'm not doing multiple queries.  I'm trying to add some functionality and
not have to do multiple queries.  I've worked with the Suggester and so far
I've not been able to get that to do what I need.  I'll revisit the
suggester component and see if I can make it do what I need.

I have a kind of specialized search that I'm implenmenting.  It's actually
working great.  I just need this one more piece to make it just about
perfect.  




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451p4009470.html
Sent from the Solr - User mailing list archive at Nabble.com.