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 "Ramrakhiani, Vikas" <Vi...@deshaw.com> on 2003/05/13 09:35:42 UTC

Searching on multiple default fields

Hi,

I am using Lucene 1.3. I want the 'default' search field to point to
multiple fields (actually, all available fields).
Is there API support to accomplish this ?

thanks for your help,
vikas.

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


Re: Searching on multiple default fields

Posted by Kelvin Tan <ke...@relevanz.com>.

On Tue, 13 May 2003 21:20:25 -0600, Tatu Saloranta said:
>On Tuesday 13 May 2003 18:53, Kelvin Tan wrote:
>>I confess that I've never quite understood the use of
>>Field.UnStored. So
>>the field is indexed but the original content is not saved?
<snip>
>This way content
>won't be
>stored twice. Similarly, for web pages, pages are likely to already
>exist in
>the file system. Why store a duplicate in the index?
>
>In fact I think more often than not storing content in Lucene index
>doesn't
>make much sense. As long as content is stored somewhere from where
>it can
>easily be accessed (using unique id or so), chances are that
>searches (not to
>mention indexing) are also faster when content is not stored, just
>indexed?
>

That's a very good point. I wonder why it didn't occur to me previously. I 
suppose there are instances when it is expensive to retrieve the source 
(network overhead etc), but they are the exception rather than the norm. 

Thanks for the insight.

Kelvin

>Just my 2 cents,
>
>-+ Tatu +-
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org





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


Re: Searching on multiple default fields

Posted by Tatu Saloranta <ta...@hypermall.net>.
On Tuesday 13 May 2003 18:53, Kelvin Tan wrote:
> I confess that I've never quite understood the use of Field.UnStored. So
> the field is indexed but the original content is not saved?

Actually, that makes lots of sense in many cases. For example, original 
content is likely to be already stored in a database, to be accessed by 
non-search functionality, using normal SQL (etC) access. But searches are 
indexed using Lucene, because of its greater flexibility (OracleText, 
formerly known as Intermedia has similar features, but its proprietary... 
other DBs may have similar proprietary extensions). This way content won't be 
stored twice. Similarly, for web pages, pages are likely to already exist in 
the file system. Why store a duplicate in the index?

In fact I think more often than not storing content in Lucene index doesn't 
make much sense. As long as content is stored somewhere from where it can 
easily be accessed (using unique id or so), chances are that searches (not to 
mention indexing) are also faster when content is not stored, just indexed?

Just my 2 cents,

-+ Tatu +-


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


Re: Searching on multiple default fields

Posted by Erik Hatcher <li...@ehatchersolutions.com>.
On Tuesday, May 13, 2003, at 08:53  PM, Kelvin Tan wrote:
> I confess that I've never quite understood the use of Field.UnStored. 
> So the
> field is indexed but the original content is not saved?

In my code that I pulled that example from, I store data in another 
field ("body") but do not search on that field (since it is HTML 
content).  I modified the example slightly to paste in the e-mail, and 
I actually glue bodyText into the "contents" field.  bodyText is the 
text-only part of "body".  There is some duplication, agreed, but so 
far performance has not at all been an issue.

	Erik


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


Re: Searching on multiple default fields

Posted by Kelvin Tan <ke...@relevanz.com>.
I confess that I've never quite understood the use of Field.UnStored. So the 
field is indexed but the original content is not saved? 

btw, an obvious drawback of this approach is when attempting to index large 
files (>10MB for instance), because it means you'll actually be indexing it 
twice. If use is just for normal fields, its great.

Kelvin

On Tue, 13 May 2003 06:08:32 -0400, Erik Hatcher said:
>Or as is often seen with Lucene usage, all fields can be glued
>together
>into a "contents" field, which is then used as the default search
>field
>like this:
>
>doc.add(Field.Text("title", title));
>doc.add(Field.UnIndexed("body", body));
>doc.add(Field.Keyword("category",category));
>
>doc.add(Field.UnStored("contents", title +
>" " + body +
>" " + category));
>
>This gives individual field access if desired, but by default any
>field
>is searchable by one aggregate one.  Note the space added between
>text
>on the "contents" field above!
>
>    Erik
>
>On Tuesday, May 13, 2003, at 03:40  AM, Kelvin Tan wrote:
>>You can use MultiFieldQueryParser to accomplish something to that
>>effect...
>>
>>Kelvin
>>
>>On Tue, 13 May 2003 13:05:42 +0530, Ramrakhiani, Vikas said:
>>>Hi,
>>>
>>>I am using Lucene 1.3. I want the 'default' search field to point
>>>to
>>>multiple fields (actually, all available fields).
>>>Is there API support to accomplish this ?
>>>
>>>thanks for your help,
>>>vikas.
>>>
>>>-------------------------------------------------------------------
>>>--
>>>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: lucene-user-
>>>help@jakarta.apache.org
>>
>>
>>
>>
>>
>>--------------------------------------------------------------------
>>-
>>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: lucene-user-
>>help@jakarta.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org





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


Re: Searching on multiple default fields

Posted by Erik Hatcher <li...@ehatchersolutions.com>.
Or as is often seen with Lucene usage, all fields can be glued together 
into a "contents" field, which is then used as the default search field 
like this:

doc.add(Field.Text("title", title));
doc.add(Field.UnIndexed("body", body));
doc.add(Field.Keyword("category",category));

doc.add(Field.UnStored("contents", title +
                 " " + body +
                 " " + category));

This gives individual field access if desired, but by default any field 
is searchable by one aggregate one.  Note the space added between text 
on the "contents" field above!

	Erik

On Tuesday, May 13, 2003, at 03:40  AM, Kelvin Tan wrote:
> You can use MultiFieldQueryParser to accomplish something to that 
> effect...
>
> Kelvin
>
> On Tue, 13 May 2003 13:05:42 +0530, Ramrakhiani, Vikas said:
>> Hi,
>>
>> I am using Lucene 1.3. I want the 'default' search field to point to
>> multiple fields (actually, all available fields).
>> Is there API support to accomplish this ?
>>
>> thanks for your help,
>> vikas.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


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


Re: Searching on multiple default fields

Posted by Kelvin Tan <ke...@relevanz.com>.
You can use MultiFieldQueryParser to accomplish something to that effect...

Kelvin

On Tue, 13 May 2003 13:05:42 +0530, Ramrakhiani, Vikas said:
>Hi,
>
>I am using Lucene 1.3. I want the 'default' search field to point to
>multiple fields (actually, all available fields).
>Is there API support to accomplish this ?
>
>thanks for your help,
>vikas.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org





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