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 "haiwei.xie-soulinfo" <ha...@soulinfo.com> on 2014/10/11 05:09:32 UTC

Search "_all" field with a term

hi all,
   
    Does lucene support all fields with a term?  Can I use "_all" intead "fieldname"?

   As Lucene's APIs example code:
     ...
    // Parse a simple query that searches for "text":
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, "fieldname", analyzer);
    Query query = parser.parse("text");
     ...
   
Thanks
-- 
haiwei

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


RE: Search "_all" field with a term

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,


>       'Internally this is  indexing every field a second time into the "_all" field.'
> This sentence mean second indexing has total different analyzer and
> indexing compared with my first indexing? 

Exactly.

> So I need rewrite the second
> process to fix my problem?

In Elasticsearch you can define the analyzer for the "_all" field. It is just configureable through the mapping like any other field.

But you should ask those questions on the Elasticsearch mailing list.

> > Hi,
> >
> > by default there is no "_all" field. E.g., Elasticsearch adds this special field
> depending on your index mapping at the time of indexing the data. Internally
> this is  indexing every field a second time into the "_all" field.
> >
> > With Lucene you have to do this on yourself. An alternative would be to
> use another query parser (like the SimpleQueryParser, see
> http://goo.gl/4blGsp) that allows to expand the query to search on multiple
> fields with different weight factors.
> >
> > Uwe
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> >
> > > -----Original Message-----
> > > From: haiwei.xie-soulinfo [mailto:haiwei.xie@soulinfo.com]
> > > Sent: Saturday, October 11, 2014 5:10 AM
> > > To: java-user@lucene.apache.org
> > > Subject: Search "_all" field with a term
> > >
> > > hi all,
> > >
> > >     Does lucene support all fields with a term?  Can I use "_all"
> > > intead "fieldname"?
> > >
> > >    As Lucene's APIs example code:
> > >      ...
> > >     // Parse a simple query that searches for "text":
> > >     QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,
> > > "fieldname", analyzer);
> > >     Query query = parser.parse("text");
> > >      ...
> > >
> > > Thanks
> > > --
> > > haiwei
> > >
> > > --------------------------------------------------------------------
> > > - 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
> >
> 
> 
> --
> haiwei
> 
> ---------------------------------------------------------------------
> 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: Search "_all" field with a term

Posted by "haiwei.xie-soulinfo" <ha...@soulinfo.com>.
> You should ask this on the elasticsearch mailing list.
> 
> BTW, look at elasticsearch copy_to feature. Better than _all field.
> 
> My 2 cents.

I will try it. thanks.

> 
>
> David ;-)
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> > Le 11 oct. 2014 à 11:31, "haiwei.xie-soulinfo" <ha...@soulinfo.com> a écrit :
> > 
> > Hi,
> > 
> >     Thanks for your advise, SimpleQueryParser api is not enough in my case.
> > Actually, I want to index data from database, there are so many fields, I have
> > tested "_all" parameter in ElasticSearch system, but the result of '_all'
> > and 'fieldname' are different for chinese term. 
> > 
> >      'Internally this is  indexing every field a second time into the "_all" field.' 
> > This sentence mean second indexing has total different analyzer and indexing compared
> > with my first indexing?  So I need rewrite the second process to fix my problem?
> > 
> > Thanks.
> > 
> > Haiwei
> > 
> > 
> >> Hi,
> >> 
> >> by default there is no "_all" field. E.g., Elasticsearch adds this special field depending on your index mapping at the time of indexing the data. Internally this is  indexing every field a second time into the "_all" field.
> >> 
> >> With Lucene you have to do this on yourself. An alternative would be to use another query parser (like the SimpleQueryParser, see http://goo.gl/4blGsp) that allows to expand the query to search on multiple fields with different weight factors.
> >> 
> >> Uwe
> >> 
> >> -----
> >> Uwe Schindler
> >> H.-H.-Meier-Allee 63, D-28213 Bremen
> >> http://www.thetaphi.de
> >> eMail: uwe@thetaphi.de
> >> 
> >> 
> >>> -----Original Message-----
> >>> From: haiwei.xie-soulinfo [mailto:haiwei.xie@soulinfo.com]
> >>> Sent: Saturday, October 11, 2014 5:10 AM
> >>> To: java-user@lucene.apache.org
> >>> Subject: Search "_all" field with a term
> >>> 
> >>> hi all,
> >>> 
> >>>    Does lucene support all fields with a term?  Can I use "_all" intead
> >>> "fieldname"?
> >>> 
> >>>   As Lucene's APIs example code:
> >>>     ...
> >>>    // Parse a simple query that searches for "text":
> >>>    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,
> >>> "fieldname", analyzer);
> >>>    Query query = parser.parse("text");
> >>>     ...
> >>> 
> >>> Thanks
> >>> --
> >>> haiwei
> >>> 
> >>> ---------------------------------------------------------------------
> >>> 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
> > 
> > 
> > -- 
> > haiwei
> > 
> > ---------------------------------------------------------------------
> > 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
> 


-- 
haiwei

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


Re: Search "_all" field with a term

Posted by David Pilato <da...@pilato.fr>.
You should ask this on the elasticsearch mailing list.

BTW, look at elasticsearch copy_to feature. Better than _all field.

My 2 cents.

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 11 oct. 2014 à 11:31, "haiwei.xie-soulinfo" <ha...@soulinfo.com> a écrit :
> 
> Hi,
> 
>     Thanks for your advise, SimpleQueryParser api is not enough in my case.
> Actually, I want to index data from database, there are so many fields, I have
> tested "_all" parameter in ElasticSearch system, but the result of '_all'
> and 'fieldname' are different for chinese term. 
> 
>      'Internally this is  indexing every field a second time into the "_all" field.' 
> This sentence mean second indexing has total different analyzer and indexing compared
> with my first indexing?  So I need rewrite the second process to fix my problem?
> 
> Thanks.
> 
> Haiwei
> 
> 
>> Hi,
>> 
>> by default there is no "_all" field. E.g., Elasticsearch adds this special field depending on your index mapping at the time of indexing the data. Internally this is  indexing every field a second time into the "_all" field.
>> 
>> With Lucene you have to do this on yourself. An alternative would be to use another query parser (like the SimpleQueryParser, see http://goo.gl/4blGsp) that allows to expand the query to search on multiple fields with different weight factors.
>> 
>> Uwe
>> 
>> -----
>> Uwe Schindler
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>> http://www.thetaphi.de
>> eMail: uwe@thetaphi.de
>> 
>> 
>>> -----Original Message-----
>>> From: haiwei.xie-soulinfo [mailto:haiwei.xie@soulinfo.com]
>>> Sent: Saturday, October 11, 2014 5:10 AM
>>> To: java-user@lucene.apache.org
>>> Subject: Search "_all" field with a term
>>> 
>>> hi all,
>>> 
>>>    Does lucene support all fields with a term?  Can I use "_all" intead
>>> "fieldname"?
>>> 
>>>   As Lucene's APIs example code:
>>>     ...
>>>    // Parse a simple query that searches for "text":
>>>    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,
>>> "fieldname", analyzer);
>>>    Query query = parser.parse("text");
>>>     ...
>>> 
>>> Thanks
>>> --
>>> haiwei
>>> 
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> -- 
> haiwei
> 
> ---------------------------------------------------------------------
> 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: Search "_all" field with a term

Posted by "haiwei.xie-soulinfo" <ha...@soulinfo.com>.
Hi,

     Thanks for your advise, SimpleQueryParser api is not enough in my case.
Actually, I want to index data from database, there are so many fields, I have
tested "_all" parameter in ElasticSearch system, but the result of '_all'
and 'fieldname' are different for chinese term. 

      'Internally this is  indexing every field a second time into the "_all" field.' 
This sentence mean second indexing has total different analyzer and indexing compared
with my first indexing?  So I need rewrite the second process to fix my problem?

Thanks.

Haiwei


> Hi,
> 
> by default there is no "_all" field. E.g., Elasticsearch adds this special field depending on your index mapping at the time of indexing the data. Internally this is  indexing every field a second time into the "_all" field.
> 
> With Lucene you have to do this on yourself. An alternative would be to use another query parser (like the SimpleQueryParser, see http://goo.gl/4blGsp) that allows to expand the query to search on multiple fields with different weight factors.
> 
> Uwe
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
> 
> 
> > -----Original Message-----
> > From: haiwei.xie-soulinfo [mailto:haiwei.xie@soulinfo.com]
> > Sent: Saturday, October 11, 2014 5:10 AM
> > To: java-user@lucene.apache.org
> > Subject: Search "_all" field with a term
> > 
> > hi all,
> > 
> >     Does lucene support all fields with a term?  Can I use "_all" intead
> > "fieldname"?
> > 
> >    As Lucene's APIs example code:
> >      ...
> >     // Parse a simple query that searches for "text":
> >     QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,
> > "fieldname", analyzer);
> >     Query query = parser.parse("text");
> >      ...
> > 
> > Thanks
> > --
> > haiwei
> > 
> > ---------------------------------------------------------------------
> > 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
> 


-- 
haiwei

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


RE: Search "_all" field with a term

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

by default there is no "_all" field. E.g., Elasticsearch adds this special field depending on your index mapping at the time of indexing the data. Internally this is  indexing every field a second time into the "_all" field.

With Lucene you have to do this on yourself. An alternative would be to use another query parser (like the SimpleQueryParser, see http://goo.gl/4blGsp) that allows to expand the query to search on multiple fields with different weight factors.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: haiwei.xie-soulinfo [mailto:haiwei.xie@soulinfo.com]
> Sent: Saturday, October 11, 2014 5:10 AM
> To: java-user@lucene.apache.org
> Subject: Search "_all" field with a term
> 
> hi all,
> 
>     Does lucene support all fields with a term?  Can I use "_all" intead
> "fieldname"?
> 
>    As Lucene's APIs example code:
>      ...
>     // Parse a simple query that searches for "text":
>     QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,
> "fieldname", analyzer);
>     Query query = parser.parse("text");
>      ...
> 
> Thanks
> --
> haiwei
> 
> ---------------------------------------------------------------------
> 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