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 Iam Jabour <ia...@gmail.com> on 2010/09/15 15:20:09 UTC

Hierarchical Fields

 Hello, any one can help me with fields?

I have the same problem posted in
http://search.lucidimagination.com/search/out?u=http://wiki.apache.org/lucene-java/HierarchicalFields,
but I don't like the proposed solutions. I need a order field, like [
token1, token2, token3]
If a query match with token1 the score is bigger then a match in
token2, or same thing like that.

______________
Iam Jabour

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


Re: Hierarchical Fields

Posted by Iam Jabour <ia...@gmail.com>.
Hi Steve and how want help,

in this direction I added boost to fields, a bit different of in
queryParser like you suggestion, but I have some quastions:

1-  If I set boost to a fields they are sum to be used like doc.boost ?
2 - If field1_boost=2 and field2_boost=1 and query match to field1 in
document 1 and to field2 in document2, document1 and document2 have
the same score (when I use multfieldquery) ?

______________
Iam Jabour




On Wed, Sep 15, 2010 at 2:03 PM, Steven A Rowe <sa...@syr.edu> wrote:
> Summarizing a #lucene conversation I had with Iam (aka PackageLost):
>
> -----
> Steve: How deep is your hierarchy? I ask because you may be able to have one field for each level in the hierarchy, and boost the levels higher the closer they are to the root
>
> Iam: Hum, now is ... 5-7.  I think 6
>
> Steve: If you have fields "level1", "level2", "level3", etc., and boost level1 highest, level2 a little lower, etc., then search against all levels
>
> Iam: But can a document have different fields? There are all fields and plus those N levels fields but some documents just need 2 levels.
>
> Steve: Lucene does not require every document to have the same set of fields. doc1 could have field "A", and nothing else, and doc2 could have field "B" and nothing else, both in the same index. No problem.
> -----
>
> An example: Iam's third query from below ("pop") could be expanded to the following QueryParser query (assuming just one "content" field in addition to the "levelX" fields):
>
> content:pop level1:pop^128 level2:pop^64 level3:pop^32 level4:pop^16 level5:pop^8 level6:pop^4 level7:pop^2
>
> This would result in doc4, doc5, doc2, which is the desired behavior.
>
> Steve
>
>
> (12:30:14 PM) sarowe:
>> -----Original Message-----
>> From: Iam Jabour [mailto:iamjabour@gmail.com]
>> Sent: Wednesday, September 15, 2010 12:22 PM
>> To: java-user@lucene.apache.org
>> Subject: Re: Hierarchical Fields
>>
>> Let's go to some example:
>>
>> 1 - Suppose I have some path tree, like:
>> - /music/
>>   | - rock/
>>     | - doc1 = "artist1 music blues ..."
>>     | - doc2 = "artist2 music pop ..."
>>   | - blues/
>>     | - doc3 = "artist3  ..."
>>     | - pop/
>>         - doc5 = "artist1 ... "
>>   | - pop/
>>     | -  doc4 = "artist1 music rock ..."
>>
>> 2 - I created lucene documents like this example:
>>  field1 = ("path", doc1fullpath)
>>  field2 = ("value", doc1Value)
>> and do the same to all documents.
>>
>> 3 - now I going to do the search:
>>   $ rock
>> I get some sort like: [doc4, doc1, doc2]
>> but I want: [doc1 | doc2] and the others [doc3 & doc4] like doc1, doc2,
>> doc4
>>
>>   $ music AND blues
>> I get: doc1, doc3
>> but I want: doc3, doc1
>>
>>   $ pop
>> I want: doc4 then doc5 (because the path to doc4 is smaller then doc5)
>>
>> So to do this I need:
>> 1 - change field boost
>> 2 - set priority of path, and to do that: I create N field (one field
>> to node in the path) or have some Lucene feature (but I don't know
>> how)
>>
>> Thanks.
>> ______________
>> Iam Jabour
>>
>>
>>
>>
>> On Wed, Sep 15, 2010 at 12:52 PM, Steven A Rowe <sa...@syr.edu> wrote:
>> > Hi Iam,
>> >
>> > Can you say why you don't like the proposed solution?
>> >
>> > Also, the example of the scoring you're looking for doesn't appear to be
>> hierarchical in nature - can you give illustrate the relationship between
>> the tokens in [token1, token2, token3]?  Also, why do you want token1 to
>> contribute more to the score than token2?
>> >
>> > Steve
>> >
>> >> -----Original Message-----
>> >> From: Iam Jabour [mailto:iamjabour@gmail.com]
>> >> Sent: Wednesday, September 15, 2010 9:20 AM
>> >> To: lucene-group
>> >> Subject: Hierarchical Fields
>> >>
>> >>  Hello, any one can help me with fields?
>> >>
>> >> I have the same problem posted in
>> >>
>> http://search.lucidimagination.com/search/out?u=http://wiki.apache.org/luc
>> >> ene-java/HierarchicalFields,
>> >> but I don't like the proposed solutions. I need a order field, like [
>> >> token1, token2, token3]
>> >> If a query match with token1 the score is bigger then a match in
>> >> token2, or same thing like that.
>> >>
>> >> ______________
>> >> Iam Jabour
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> >> For additional commands, e-mail: java-user-help@lucene.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


RE: Hierarchical Fields

Posted by Steven A Rowe <sa...@syr.edu>.
Summarizing a #lucene conversation I had with Iam (aka PackageLost):

-----
Steve: How deep is your hierarchy? I ask because you may be able to have one field for each level in the hierarchy, and boost the levels higher the closer they are to the root

Iam: Hum, now is ... 5-7.  I think 6

Steve: If you have fields "level1", "level2", "level3", etc., and boost level1 highest, level2 a little lower, etc., then search against all levels

Iam: But can a document have different fields? There are all fields and plus those N levels fields but some documents just need 2 levels.

Steve: Lucene does not require every document to have the same set of fields. doc1 could have field "A", and nothing else, and doc2 could have field "B" and nothing else, both in the same index. No problem.
-----

An example: Iam's third query from below ("pop") could be expanded to the following QueryParser query (assuming just one "content" field in addition to the "levelX" fields):

content:pop level1:pop^128 level2:pop^64 level3:pop^32 level4:pop^16 level5:pop^8 level6:pop^4 level7:pop^2

This would result in doc4, doc5, doc2, which is the desired behavior.

Steve


(12:30:14 PM) sarowe: 
> -----Original Message-----
> From: Iam Jabour [mailto:iamjabour@gmail.com]
> Sent: Wednesday, September 15, 2010 12:22 PM
> To: java-user@lucene.apache.org
> Subject: Re: Hierarchical Fields
> 
> Let's go to some example:
> 
> 1 - Suppose I have some path tree, like:
> - /music/
>   | - rock/
>     | - doc1 = "artist1 music blues ..."
>     | - doc2 = "artist2 music pop ..."
>   | - blues/
>     | - doc3 = "artist3  ..."
>     | - pop/
>         - doc5 = "artist1 ... "
>   | - pop/
>     | -  doc4 = "artist1 music rock ..."
> 
> 2 - I created lucene documents like this example:
>  field1 = ("path", doc1fullpath)
>  field2 = ("value", doc1Value)
> and do the same to all documents.
> 
> 3 - now I going to do the search:
>   $ rock
> I get some sort like: [doc4, doc1, doc2]
> but I want: [doc1 | doc2] and the others [doc3 & doc4] like doc1, doc2,
> doc4
> 
>   $ music AND blues
> I get: doc1, doc3
> but I want: doc3, doc1
> 
>   $ pop
> I want: doc4 then doc5 (because the path to doc4 is smaller then doc5)
> 
> So to do this I need:
> 1 - change field boost
> 2 - set priority of path, and to do that: I create N field (one field
> to node in the path) or have some Lucene feature (but I don't know
> how)
> 
> Thanks.
> ______________
> Iam Jabour
> 
> 
> 
> 
> On Wed, Sep 15, 2010 at 12:52 PM, Steven A Rowe <sa...@syr.edu> wrote:
> > Hi Iam,
> >
> > Can you say why you don't like the proposed solution?
> >
> > Also, the example of the scoring you're looking for doesn't appear to be
> hierarchical in nature - can you give illustrate the relationship between
> the tokens in [token1, token2, token3]?  Also, why do you want token1 to
> contribute more to the score than token2?
> >
> > Steve
> >
> >> -----Original Message-----
> >> From: Iam Jabour [mailto:iamjabour@gmail.com]
> >> Sent: Wednesday, September 15, 2010 9:20 AM
> >> To: lucene-group
> >> Subject: Hierarchical Fields
> >>
> >>  Hello, any one can help me with fields?
> >>
> >> I have the same problem posted in
> >>
> http://search.lucidimagination.com/search/out?u=http://wiki.apache.org/luc
> >> ene-java/HierarchicalFields,
> >> but I don't like the proposed solutions. I need a order field, like [
> >> token1, token2, token3]
> >> If a query match with token1 the score is bigger then a match in
> >> token2, or same thing like that.
> >>
> >> ______________
> >> Iam Jabour
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Hierarchical Fields

Posted by Iam Jabour <ia...@gmail.com>.
Let's go to some example:

1 - Suppose I have some path tree, like:
- /music/
  | - rock/
    | - doc1 = "artist1 music blues ..."
    | - doc2 = "artist2 music pop ..."
  | - blues/
    | - doc3 = "artist3  ..."
    | - pop/
        - doc5 = "artist1 ... "
  | - pop/
    | -  doc4 = "artist1 music rock ..."

2 - I created lucene documents like this example:
 field1 = ("path", doc1fullpath)
 field2 = ("value", doc1Value)
and do the same to all documents.

3 - now I going to do the search:
  $ rock
I get some sort like: [doc4, doc1, doc2]
but I want: [doc1 | doc2] and the others [doc3 & doc4] like doc1, doc2, doc4

  $ music AND blues
I get: doc1, doc3
but I want: doc3, doc1

  $ pop
I want: doc4 then doc5 (because the path to doc4 is smaller then doc5)

So to do this I need:
1 - change field boost
2 - set priority of path, and to do that: I create N field (one field
to node in the path) or have some Lucene feature (but I don't know
how)

Thanks.
______________
Iam Jabour




On Wed, Sep 15, 2010 at 12:52 PM, Steven A Rowe <sa...@syr.edu> wrote:
> Hi Iam,
>
> Can you say why you don't like the proposed solution?
>
> Also, the example of the scoring you're looking for doesn't appear to be hierarchical in nature - can you give illustrate the relationship between the tokens in [token1, token2, token3]?  Also, why do you want token1 to contribute more to the score than token2?
>
> Steve
>
>> -----Original Message-----
>> From: Iam Jabour [mailto:iamjabour@gmail.com]
>> Sent: Wednesday, September 15, 2010 9:20 AM
>> To: lucene-group
>> Subject: Hierarchical Fields
>>
>>  Hello, any one can help me with fields?
>>
>> I have the same problem posted in
>> http://search.lucidimagination.com/search/out?u=http://wiki.apache.org/luc
>> ene-java/HierarchicalFields,
>> but I don't like the proposed solutions. I need a order field, like [
>> token1, token2, token3]
>> If a query match with token1 the score is bigger then a match in
>> token2, or same thing like that.
>>
>> ______________
>> Iam Jabour
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


RE: Hierarchical Fields

Posted by Steven A Rowe <sa...@syr.edu>.
Hi Iam,

Can you say why you don't like the proposed solution?

Also, the example of the scoring you're looking for doesn't appear to be hierarchical in nature - can you give illustrate the relationship between the tokens in [token1, token2, token3]?  Also, why do you want token1 to contribute more to the score than token2?

Steve

> -----Original Message-----
> From: Iam Jabour [mailto:iamjabour@gmail.com]
> Sent: Wednesday, September 15, 2010 9:20 AM
> To: lucene-group
> Subject: Hierarchical Fields
> 
>  Hello, any one can help me with fields?
> 
> I have the same problem posted in
> http://search.lucidimagination.com/search/out?u=http://wiki.apache.org/luc
> ene-java/HierarchicalFields,
> but I don't like the proposed solutions. I need a order field, like [
> token1, token2, token3]
> If a query match with token1 the score is bigger then a match in
> token2, or same thing like that.
> 
> ______________
> Iam Jabour
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org