Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Search terms on a single "instance" of field

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


rafael.rossini at gmail

Jul 26, 2007, 12:32 PM

Post #1 of 5 (279 views)
Permalink
Search terms on a single "instance" of field

Hi guys,

I have a problem that is kind of tricky:

I have a set of documents that I enrich with dynamic metadata. The
metada name is the fieldName in lucene and the value is the text. For
example:
"Rio de Janeiro is a beautiful city." would be indexed in one field called
text, and on another field, I would do something like new Field("city", "Rio
de Janeiro" ....). With this I can search on documents like this city:rio.

The thing is, we now are composing more complex information on a
text, like this:
"Daniel, the new presidente of Company XY, is 30 years old, but on
Company AB the director, George, is much older. He is 80 now."
I will add on a document 2 fields, like Field("position",
"Daniel president Company XY", ...); Field("position", "George director
Company AB", ...). With this I´d like to search for documents that has
daniel and president on the same field, because in a same text, can exist
daniel and president in different fields. Is this possible?? I know that if
I had and index where the Document is a phrase like this, it would solve my
problem, but I´d like to stay with only one index.

Hope I made myself clear.

[]s
Rossini


a.schrijvers at hippo

Jul 27, 2007, 12:21 AM

Post #2 of 5 (271 views)
Permalink
RE: Search terms on a single "instance" of field [In reply to]

Hello,
>

> Company AB", ...). With this I´d like to search for documents that has
> daniel and president on the same field, because in a same
> text, can exist
> daniel and president in different fields. Is this possible??

Not totally sure wether I understand your problem, because it does not sound like a problem at all:

If you just have a query that looks like: fieldA:termA + fieldA:termB you are looking for documents which have termA AND termB in fieldA.

Isn't that all you want/need?

Regards Ard

> I know that if
> I had and index where the Document is a phrase like this, it
> would solve my
> problem, but I´d like to stay with only one index.
>
> Hope I made myself clear.
>
> []s
> Rossini
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


rafael.rossini at gmail

Jul 27, 2007, 7:33 AM

Post #3 of 5 (263 views)
Permalink
Re: Search terms on a single "instance" of field [In reply to]

Actually no,

Because I'd like to retrieve terms that were computed on the same
instance of Field. Taking your example to ilustrate better, I have 2
documents, on documentA I structured one field, Field("fieldA", "termA
termB", customAnalyzer). On documentB I structured 2 fields, Field("fieldA",
"termA termC", customAnalyzer) and Field("fieldA", "termB termC",
customAnalyzer).

The problem is, if I search like you suggested, fieldA:termA +
fieldA:termB, I will get both documents, but I want only documentA. For that
to happen, somehow, somewhere should be an information that tells that on
documentA, termA and termB where indexed on the same instance of fieldA. I´m
guessing this is not possible, but it would be great if someone has an ideia
to solve this.

Thanks for the response Ard.

[]s
Rossini


On 7/27/07, Ard Schrijvers <a.schrijvers [at] hippo> wrote:
>
> Hello,
> >
>
> > Company AB", ...). With this I´d like to search for documents that has
> > daniel and president on the same field, because in a same
> > text, can exist
> > daniel and president in different fields. Is this possible??
>
> Not totally sure wether I understand your problem, because it does not
> sound like a problem at all:
>
> If you just have a query that looks like: fieldA:termA + fieldA:termB you
> are looking for documents which have termA AND termB in fieldA.
>
> Isn't that all you want/need?
>
> Regards Ard
>
> > I know that if
> > I had and index where the Document is a phrase like this, it
> > would solve my
> > problem, but I´d like to stay with only one index.
> >
> > Hope I made myself clear.
> >
> > []s
> > Rossini
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


jeff at mdbconsulting

Jul 29, 2007, 3:08 PM

Post #4 of 5 (253 views)
Permalink
Re: Search terms on a single "instance" of field [In reply to]

Rossini, have you had any luck with this? I don't know if this solves your
exact problem, but could you do something like this:

1. Use Analyzer.getPositionIncrementGap to create a gap (let's say 100)
between your fieldA's.
2. Then query like this:

fieldA:("termA termB"~99)

I did this playing around with table cells, and it seems to work so far.

Jeff


rossini wrote:
>
> Actually no,
>
> Because I'd like to retrieve terms that were computed on the same
> instance of Field. Taking your example to ilustrate better, I have 2
> documents, on documentA I structured one field, Field("fieldA", "termA
> termB", customAnalyzer). On documentB I structured 2 fields,
> Field("fieldA",
> "termA termC", customAnalyzer) and Field("fieldA", "termB termC",
> customAnalyzer).
>
> The problem is, if I search like you suggested, fieldA:termA +
> fieldA:termB, I will get both documents, but I want only documentA. For
> that
> to happen, somehow, somewhere should be an information that tells that on
> documentA, termA and termB where indexed on the same instance of fieldA.
> I´m
> guessing this is not possible, but it would be great if someone has an
> ideia
> to solve this.
>
--
View this message in context: http://www.nabble.com/Search-terms-on-a-single-%22instance%22-of-field-tf4153674.html#a11855658
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


rafael.rossini at gmail

Jul 30, 2007, 7:39 AM

Post #5 of 5 (253 views)
Permalink
Re: Search terms on a single "instance" of field [In reply to]

Hey Jeff, I didn´t had any luck, I don´t think you´re approach is going to
help me, thanks for the reply. I´ll try a solution that does not require
this kind of problem.

[]s
Rossini


On 7/29/07, Jeff French <jeff [at] mdbconsulting> wrote:
>
>
> Rossini, have you had any luck with this? I don't know if this solves
> your
> exact problem, but could you do something like this:
>
> 1. Use Analyzer.getPositionIncrementGap to create a gap (let's say 100)
> between your fieldA's.
> 2. Then query like this:
>
> fieldA:("termA termB"~99)
>
> I did this playing around with table cells, and it seems to work so far.
>
> Jeff
>
>
> rossini wrote:
> >
> > Actually no,
> >
> > Because I'd like to retrieve terms that were computed on the same
> > instance of Field. Taking your example to ilustrate better, I have 2
> > documents, on documentA I structured one field, Field("fieldA", "termA
> > termB", customAnalyzer). On documentB I structured 2 fields,
> > Field("fieldA",
> > "termA termC", customAnalyzer) and Field("fieldA", "termB termC",
> > customAnalyzer).
> >
> > The problem is, if I search like you suggested, fieldA:termA +
> > fieldA:termB, I will get both documents, but I want only documentA. For
> > that
> > to happen, somehow, somewhere should be an information that tells that
> on
> > documentA, termA and termB where indexed on the same instance of fieldA.
> > I´m
> > guessing this is not possible, but it would be great if someone has an
> > ideia
> > to solve this.
> >
> --
> View this message in context:
> http://www.nabble.com/Search-terms-on-a-single-%22instance%22-of-field-tf4153674.html#a11855658
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.