Highlighting for multiple phrases?

Hi everyone,

I'm having trouble forming the syntax to search for multiple phrases with
highlighting. Suppose I would like to search for:

(red balloon) OR (yellow kite) OR (black sheep)

...and highlight the results. What would the JSON look like?

For reference, I can do this using an OR filter and text_phrase, but I
don't know how to do an OR inside a query. It seems that highlighting only
works if the terms are specified in the query (not the filter).

Thanks for any help you can lend.

Ben

Hi Ben

Maybe these will help?

https://gist.github.com/3053914

https://gist.github.com/3080627

cheers

On Tuesday, 10 July 2012 at 11:35 AM, Ben Allfree wrote:

Hi everyone,

I'm having trouble forming the syntax to search for multiple phrases with highlighting. Suppose I would like to search for:

(red balloon) OR (yellow kite) OR (black sheep)

...and highlight the results. What would the JSON look like?

For reference, I can do this using an OR filter and text_phrase, but I don't know how to do an OR inside a query. It seems that highlighting only works if the terms are specified in the query (not the filter).

Thanks for any help you can lend.

Ben

Thanks, I hadn't seen those. Unfortunately I don't think query_string can
do nesting for phrases.

dog OR cat OR bird

will work, but

black dog OR brown cat OR red bird

will not :frowning:

b

On Mon, Jul 9, 2012 at 7:33 PM, shaun etherton shaun.etherton@gmail.comwrote:

Hi Ben

Maybe these will help?

https://gist.github.com/3053914

https://gist.github.com/3080627

cheers

On Tuesday, 10 July 2012 at 11:35 AM, Ben Allfree wrote:

Hi everyone,

I'm having trouble forming the syntax to search for multiple phrases with
highlighting. Suppose I would like to search for:

(red balloon) OR (yellow kite) OR (black sheep)

...and highlight the results. What would the JSON look like?

For reference, I can do this using an OR filter and text_phrase, but I
don't know how to do an OR inside a query. It seems that highlighting only
works if the terms are specified in the query (not the filter).

Thanks for any help you can lend.

Ben

Oh, i see. I didn't realise they were nested phrases.

When you workout how to do it can you gist a small example query so i can add it to my list of reference queries?

cheers.

--
shaun etherton
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, 10 July 2012 at 12:10 PM, Ben Allfree wrote:

Thanks, I hadn't seen those. Unfortunately I don't think query_string can do nesting for phrases.

dog OR cat OR bird

will work, but

black dog OR brown cat OR red bird

will not :frowning:

b

On Mon, Jul 9, 2012 at 7:33 PM, shaun etherton <shaun.etherton@gmail.com (mailto:shaun.etherton@gmail.com)> wrote:

Hi Ben

Maybe these will help?

https://gist.github.com/3053914

https://gist.github.com/3080627

cheers

On Tuesday, 10 July 2012 at 11:35 AM, Ben Allfree wrote:

Hi everyone,

I'm having trouble forming the syntax to search for multiple phrases with highlighting. Suppose I would like to search for:

(red balloon) OR (yellow kite) OR (black sheep)

...and highlight the results. What would the JSON look like?

For reference, I can do this using an OR filter and text_phrase, but I don't know how to do an OR inside a query. It seems that highlighting only works if the terms are specified in the query (not the filter).

Thanks for any help you can lend.

Ben

Sure. It would work perfectly if you could go:

text_phrase: ["black dog", "brown cat", "red bird"]

But text_phrase doesn't support arrays. You can do:

terms: ["black dog", "brown cat", "red bird"]

But terms doesn't support multiple words in a term so you get 0 results
back.

b

On Mon, Jul 9, 2012 at 7:45 PM, shaun etherton shaun.etherton@gmail.comwrote:

Oh, i see. I didn't realise they were nested phrases.

When you workout how to do it can you gist a small example query so i can
add it to my list of reference queries?

cheers.

--
shaun etherton
Sent with Sparrow http://www.sparrowmailapp.com/?sig

On Tuesday, 10 July 2012 at 12:10 PM, Ben Allfree wrote:

Thanks, I hadn't seen those. Unfortunately I don't think query_string can
do nesting for phrases.

dog OR cat OR bird

will work, but

black dog OR brown cat OR red bird

will not :frowning:

b

On Mon, Jul 9, 2012 at 7:33 PM, shaun etherton shaun.etherton@gmail.comwrote:

Hi Ben

Maybe these will help?

https://gist.github.com/3053914

https://gist.github.com/3080627

cheers

On Tuesday, 10 July 2012 at 11:35 AM, Ben Allfree wrote:

Hi everyone,

I'm having trouble forming the syntax to search for multiple phrases with
highlighting. Suppose I would like to search for:

(red balloon) OR (yellow kite) OR (black sheep)

...and highlight the results. What would the JSON look like?

For reference, I can do this using an OR filter and text_phrase, but I
don't know how to do an OR inside a query. It seems that highlighting only
works if the terms are specified in the query (not the filter).

Thanks for any help you can lend.

Ben

Hi,

"black dog" OR "brown cat" OR "red bird"

^^ does this work for you?

Regards,
Lukas

On Tue, Jul 10, 2012 at 4:48 AM, Ben Allfree ben@benallfree.com wrote:

Sure. It would work perfectly if you could go:

text_phrase: ["black dog", "brown cat", "red bird"]

But text_phrase doesn't support arrays. You can do:

terms: ["black dog", "brown cat", "red bird"]

But terms doesn't support multiple words in a term so you get 0 results
back.

b

On Mon, Jul 9, 2012 at 7:45 PM, shaun etherton shaun.etherton@gmail.comwrote:

Oh, i see. I didn't realise they were nested phrases.

When you workout how to do it can you gist a small example query so i can
add it to my list of reference queries?

cheers.

--
shaun etherton
Sent with Sparrow http://www.sparrowmailapp.com/?sig

On Tuesday, 10 July 2012 at 12:10 PM, Ben Allfree wrote:

Thanks, I hadn't seen those. Unfortunately I don't think query_string can
do nesting for phrases.

dog OR cat OR bird

will work, but

black dog OR brown cat OR red bird

will not :frowning:

b

On Mon, Jul 9, 2012 at 7:33 PM, shaun etherton shaun.etherton@gmail.comwrote:

Hi Ben

Maybe these will help?

https://gist.github.com/3053914

https://gist.github.com/3080627

cheers

On Tuesday, 10 July 2012 at 11:35 AM, Ben Allfree wrote:

Hi everyone,

I'm having trouble forming the syntax to search for multiple phrases with
highlighting. Suppose I would like to search for:

(red balloon) OR (yellow kite) OR (black sheep)

...and highlight the results. What would the JSON look like?

For reference, I can do this using an OR filter and text_phrase, but I
don't know how to do an OR inside a query. It seems that highlighting only
works if the terms are specified in the query (not the filter).

Thanks for any help you can lend.

Ben