Hi Evan,

If I understand correctly, a document has to have at least one "foo bar" 
without having "cat" in front.

A solution would be to use a combination of the ShingleFilterFactory and query 
for one occurences of "foo bar" using the termfreq function.

https://cwiki.apache.org/confluence/display/solr/Filter+Descriptions#FilterDescriptions-ShingleFilter
https://cwiki.apache.org/confluence/display/solr/Function+Queries

The number of shingles depends on how many terms are in the query and how many 
terms cannot be prefixed.

It might be easier to just retrieve all the documents which contain the phrase 
and process the results outside of Solr.
If you could shed some more light on what you are trying to accomplish, maybe 
we can help you find an even better solution to fit your problem.

Jeroen

-----Original Message-----
From: Evan Smith [mailto:e...@wingonwing.com] 
Sent: maandag 28 april 2014 19:20
To: solr-user@lucene.apache.org
Subject: Re: how to write my first solr query

Hello,

Here is a better use case

Documents A, B, C, and D

A: "dear foo bar hello"
B: "dear cat foo bar hello"
C: "dear cat foo bar hello foo bar"
D: "dear car foo bar"

I have a dictionary of items outside of solr "foo bar" and "cat foo bar"
And associated with each item is the set of "suffix's of that item"
So I know that "foo bar" has "cat foo bar" as a "suffix"

I would like to search my corpus of documents A, B, C and D And just get 
documents that contain "foo bar" and not the ones that contain "cat foo bar"

So if I searched on "foo bar" but not "cat foo bar"
I want to get documents A, C, D
But not B which does not have just "foo bar" but has "cat foo bar".
I am ok with C as it has a "foo bar" that is not prefixed with "cat".

Does this make sense?  I see that the ("foo bar" and not "cat foo bar") would 
not work as it would miss document C.  Or at least I think it would.

Evan



--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-to-write-my-first-solr-query-tp4133509p4133537.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to