You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Otmar Caduff <oc...@gmail.com> on 2016/03/25 10:20:22 UTC

Subset Matching

Hi all
In Lucene, I know of the possibility of Occur.SHOULD, Occur.MUST and the
“minimum should match” setting on the boolean query.

Now, when querying, I want to
- (1)  match the documents which either contain all the terms of the query
(Occur.MUST for all terms would do that) or,
- (2)  if all terms for a given field of a document are a subset of the
query terms, that document should match as well.

Any clue on how to accomplish this?

Otmar

Re: Subset Matching

Posted by Jack Krupansky <ja...@gmail.com>.
There is no simple, direct way to do this "Boolean Reverse Query" in
Lucene, but I suggest filing a Jira to request this as a feature
improvement/new feature.

-- Jack Krupansky

On Fri, Mar 25, 2016 at 11:43 AM, Ahmet Arslan <io...@yahoo.com.invalid>
wrote:

> Hi Otmar,
>
> For this requirement, you need to create an additional field containing
> the number of words/terms in the field.
>
>
> For example.
>
> field : blue pill
> length = 2
>
>
> query : if you take the blue pill
> length  : 6
>
>
> Please see my previous responses on the same topic:
>
> http://search-lucene.com/m/eHNluYPa11VSxlf1&subj=Re+search+for+documents+where+all+words+of+field+present+in+the+query
>
>
> http://search-lucene.com/m/eHNl9Yu6V1xx3rp&subj=Re+Match+All+terms+in+indexed+field+value
>
> I know they are solr responses but Function Queries exists in Lucene as
> far as know.
>
> Ahmet
> On Friday, March 25, 2016 11:20 AM, Otmar Caduff <oc...@gmail.com>
> wrote:
>
>
>
> Hi all
> In Lucene, I know of the possibility of Occur.SHOULD, Occur.MUST and the
> “minimum should match” setting on the boolean query.
>
> Now, when querying, I want to
> - (1)  match the documents which either contain all the terms of the query
> (Occur.MUST for all terms would do that) or,
> - (2)  if all terms for a given field of a document are a subset of the
> query terms, that document should match as well.
>
> Any clue on how to accomplish this?
>
> Otmar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Subset Matching

Posted by Ahmet Arslan <io...@yahoo.com.INVALID>.
Hi Otmar,

For this requirement, you need to create an additional field containing the number of words/terms in the field.


For example.

field : blue pill
length = 2


query : if you take the blue pill
length  : 6


Please see my previous responses on the same topic:
http://search-lucene.com/m/eHNluYPa11VSxlf1&subj=Re+search+for+documents+where+all+words+of+field+present+in+the+query

http://search-lucene.com/m/eHNl9Yu6V1xx3rp&subj=Re+Match+All+terms+in+indexed+field+value

I know they are solr responses but Function Queries exists in Lucene as far as know.

Ahmet
On Friday, March 25, 2016 11:20 AM, Otmar Caduff <oc...@gmail.com> wrote:



Hi all
In Lucene, I know of the possibility of Occur.SHOULD, Occur.MUST and the
“minimum should match” setting on the boolean query.

Now, when querying, I want to
- (1)  match the documents which either contain all the terms of the query
(Occur.MUST for all terms would do that) or,
- (2)  if all terms for a given field of a document are a subset of the
query terms, that document should match as well.

Any clue on how to accomplish this?

Otmar

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Subset Matching

Posted by Sujit Pal <su...@comcast.net>.
Hi Otmar,

Shouldn't Occur.SHOULD alone do what you ask? Documents that match all
terms in the query would be scored higher than documents that match fewer
than all terms.

-sujit

On Fri, Mar 25, 2016 at 2:20 AM, Otmar Caduff <oc...@gmail.com> wrote:

> Hi all
> In Lucene, I know of the possibility of Occur.SHOULD, Occur.MUST and the
> “minimum should match” setting on the boolean query.
>
> Now, when querying, I want to
> - (1)  match the documents which either contain all the terms of the query
> (Occur.MUST for all terms would do that) or,
> - (2)  if all terms for a given field of a document are a subset of the
> query terms, that document should match as well.
>
> Any clue on how to accomplish this?
>
> Otmar
>