TextQueryBuilder error


(davrob) #1

Hi,

I'm receiving this error:

    [contactindex_2011_06_22_16_54_43] No text specified for text

query

When building this query:

   TextQueryBuilder textQuery = new TextQueryBuilder("fullName",

"Jones");
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);

And building in a standard fashion:

	SearchRequestBuilder searchReq = client.prepareSearch()
		//.addFields(DEFAULT_FIELDS)
		.setIndices(indexes)
		.setTypes(types)
		.setQuery(textQuery)
		.setFrom(this.start)
		.setSize(pageSize);

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it
appears that I have to use TextQueryBuilder as an intermediary, is
that true?

Best Regards,

David.


(Shay Banon) #2

Which version are you using?

On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:

Hi,

I'm receiving this error:

[contactindex_2011_06_22_16_54_43] No text specified for text
query

When building this query:

TextQueryBuilder textQuery = new TextQueryBuilder("fullName",
"Jones");
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);

And building in a standard fashion:

SearchRequestBuilder searchReq = client.prepareSearch()
//.addFields(DEFAULT_FIELDS)
.setIndices(indexes)
.setTypes(types)
.setQuery(textQuery)
.setFrom(this.start)
.setSize(pageSize);

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it
appears that I have to use TextQueryBuilder as an intermediary, is
that true?

Best Regards,

David.


(davrob) #3

Hi Shay,

I'm Using 0.16.1.

On Jun 27, 6:50 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Which version are you using?

On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:

Hi,

I'm receiving this error:

[contactindex_2011_06_22_16_54_43] No text specified for text
query

When building this query:

TextQueryBuilder textQuery = new TextQueryBuilder("fullName",
"Jones");
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);

And building in a standard fashion:

SearchRequestBuilder searchReq = client.prepareSearch()
//.addFields(DEFAULT_FIELDS)
.setIndices(indexes)
.setTypes(types)
.setQuery(textQuery)
.setFrom(this.start)
.setSize(pageSize);

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it
appears that I have to use TextQueryBuilder as an intermediary, is
that true?

Best Regards,

David.


(Shay Banon) #4

Use 0.16.2, it should be fixed.

On Tuesday, June 28, 2011 at 11:33 AM, davrob2 wrote:

Hi Shay,

I'm Using 0.16.1.

On Jun 27, 6:50 pm, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

Which version are you using?

On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:

Hi,

I'm receiving this error:

[contactindex_2011_06_22_16_54_43] No text specified for text
query

When building this query:

TextQueryBuilder textQuery = new TextQueryBuilder("fullName",
"Jones");
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);

And building in a standard fashion:

SearchRequestBuilder searchReq = client.prepareSearch()
//.addFields(DEFAULT_FIELDS)
.setIndices(indexes)
.setTypes(types)
.setQuery(textQuery)
.setFrom(this.start)
.setSize(pageSize);

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it
appears that I have to use TextQueryBuilder as an intermediary, is
that true?

Best Regards,

David.


(davrob) #5

Yes, the upgrade did the trick. thanks.

On Jun 28, 9:42 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Use 0.16.2, it should be fixed.

On Tuesday, June 28, 2011 at 11:33 AM, davrob2 wrote:

Hi Shay,

I'm Using 0.16.1.

On Jun 27, 6:50 pm, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

Which version are you using?

On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:

Hi,

I'm receiving this error:

[contactindex_2011_06_22_16_54_43] No text specified for text
query

When building this query:

TextQueryBuilder textQuery = new TextQueryBuilder("fullName",
"Jones");
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);

And building in a standard fashion:

SearchRequestBuilder searchReq = client.prepareSearch()
//.addFields(DEFAULT_FIELDS)
.setIndices(indexes)
.setTypes(types)
.setQuery(textQuery)
.setFrom(this.start)
.setSize(pageSize);

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it
appears that I have to use TextQueryBuilder as an intermediary, is
that true?

Best Regards,

David.


(davrob) #6

Is there a way I can use a prefix query against a non-analysed field,
but get results back that ignore case.

The obvious way of doing this is to index an uppercase version of the
field and convert all queries to uppercase, is there a way that I can
do this without creating a new field?

On Jun 28, 4:21 pm, davrob2 davirobe...@gmail.com wrote:

Yes, the upgrade did the trick. thanks.

On Jun 28, 9:42 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Use 0.16.2, it should be fixed.

On Tuesday, June 28, 2011 at 11:33 AM, davrob2 wrote:

Hi Shay,

I'm Using 0.16.1.

On Jun 27, 6:50 pm, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

Which version are you using?

On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:

Hi,

I'm receiving this error:

[contactindex_2011_06_22_16_54_43] No text specified for text
query

When building this query:

TextQueryBuilder textQuery = new TextQueryBuilder("fullName",
"Jones");
textQuery.type(TextQueryBuilder.Type.PHRASE_PREFIX);

And building in a standard fashion:

SearchRequestBuilder searchReq = client.prepareSearch()
//.addFields(DEFAULT_FIELDS)
.setIndices(indexes)
.setTypes(types)
.setQuery(textQuery)
.setFrom(this.start)
.setSize(pageSize);

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it
appears that I have to use TextQueryBuilder as an intermediary, is
that true?

Best Regards,

David.


(Clinton Gormley) #7

Hi David

On Tue, 2011-06-28 at 09:30 -0700, davrob2 wrote:

Is there a way I can use a prefix query against a non-analysed field,
but get results back that ignore case.

Not_analyzed fields are ... not analyzed :slight_smile: So whatever you put in
there is what is stored. ES can only find terms that actually exist, so
no, you can't have a case-insensitive prefix query on a not_analyzed
field.

The obvious way of doing this is to index an uppercase version of the
field and convert all queries to uppercase, is there a way that I can
do this without creating a new field?

Two choices here:

  1. Does your field actually need to be not_analyzed? You could instead
    set it to use a custom analyzer with the keyword tokenizer
    and the lower-case token filter.

  2. Alternatively, if you need to keep the field value in the original
    case, you could use multi-fields, with the 'main' version
    not_analyzed and another version analyzed as described in (1)

http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-tokenizer.html
http://www.elasticsearch.org/guide/reference/index-modules/analysis/lowercase-tokenfilter.html
http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html

clint


(davrob) #8

Hi Clint,

yes, I thought that must be the case, but I might as well ask. Thanks
for the suggestion in 2), I will look at how that works.

David

On Jun 28, 5:42 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi David

On Tue, 2011-06-28 at 09:30 -0700, davrob2 wrote:

Is there a way I can use a prefix query against a non-analysed field,
but get results back that ignore case.

Not_analyzed fields are ... not analyzed :slight_smile: So whatever you put in
there is what is stored. ES can only find terms that actually exist, so
no, you can't have a case-insensitive prefix query on a not_analyzed
field.

The obvious way of doing this is to index an uppercase version of the
field and convert all queries to uppercase, is there a way that I can
do this without creating a new field?

Two choices here:

  1. Does your field actually need to be not_analyzed? You could instead
    set it to use a custom analyzer with the keyword tokenizer
    and the lower-case token filter.

  2. Alternatively, if you need to keep the field value in the original
    case, you could use multi-fields, with the 'main' version
    not_analyzed and another version analyzed as described in (1)

http://www.elasticsearch.org/guide/reference/index-modules/analysis/k...http://www.elasticsearch.org/guide/reference/index-modules/analysis/l...http://www.elasticsearch.org/guide/reference/mapping/multi-field-type...

clint


(system) #9