I think queries would usually not contain more than one phrase per query,
but there isn't a fixed list.

Anyways, your solution is very very good for us. We could write a
QueryParser or a SearchComponent that edits the Lucene Query object in the
ResponseBuilder to include the relevant SpanNotQuery. Thanks a lot!!!

On Thu, Dec 15, 2016 at 4:01 PM, Ahmet Arslan <iori...@yahoo.com> wrote:

> Hi,
>
>
> Span query family would be a pure query-time solution, SpanNotQuery in
> particular.
>
>
> SpanNearQuery include = new SpanTermQuery(new Term(FIELD, "world");
>
>
> SpanNearQuery exclude = new SpanNearQuery(new SpanQuery[] {
> new SpanTermQuery(new Term(FIELD, "hello")),
> new SpanTermQuery(new Term(FIELD, "world"))},
> 0,
> true);
>
> SpanQuery finalQuery = new SpanNotQuery(include, exclude)
> This finalQuery supposed to retrieve documents that have the term "world"
> but not as a part of "hello world".
>
>
>
> Is your list of phrases query dependent? If yes how many phrases per-query?
>
> Or you have a global list of phrases?
>
> Ahmet
>
> On Thursday, December 15, 2016 10:32 AM, Dean Gurvitz <dea...@gmail.com>
> wrote:
>
>
>
> Hi,
> The list of phrases wil be relatively dynamic, so changing the indexing
> process isn't a very good solution for us.
>
> We also considered using a PostFilter or adding a SearchComponent to filter
> out the "bad" results, but obviously a true query-time support would be a
> lot better.
>
>
>
> On Wed, Dec 14, 2016 at 10:52 PM, Ahmet Arslan <iori...@yahoo.com.invalid>
> wrote:
>
> > Hi,
> >
> > Do you have a common list of phrases that you want to prohibit partial
> > match?
> > You can index those phrases in a special way, for example,
> >
> > This is a new world hello_world hot_dog tap_water etc.
> >
> > ahmet
> >
> >
> > On Wednesday, December 14, 2016 9:20 PM, deansg <dea...@gmail.com>
> wrote:
> > We would like to enable queries for a specific term that doesn't appear
> as
> > a
> > part of a given expression. Negating the expression will not help, as we
> > still want to return items that contain the term independently, even if
> > they
> > contain full expression as well.
> > For example, we would like to search for items that have the term "world"
> > but not as a part of "hello world". If the text is: "This is a new world.
> > Hello world", we would still want to return the item, as "world" appears
> > independently as well as a part of "Hello world". However, we will not
> want
> > to return items that only have the expression "hello world" in them.
> > Does Solr support these types of queries? We thought about using regex,
> but
> > since the text is tokenized I don't think that will be possible.
> >
> >
> >
> > --
> > View this message in context: http://lucene.472066.n3.
> > nabble.com/Searching-for-a-term-which-isn-t-a-part-of-an-
> > expression-tp4309746.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>

Reply via email to