Help with query

Hi, trying to do a query against 3 fields, and then boost by more
recent date. The query executes ok, but it seems like none of the
boosting is really working. Any help appreciated. Here's my code:
(groovy code)

DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
DateTime dt = new DateTime(new Date());
dt = dt.minusDays(30)
String jodaThen = fmt.print(dt)

    def bodyContent = [query: [

            bool: [
                    must: [
                            dis_max: [
                                    tie_breaker: 0.7,
                                    boost: 1.2,
                                    queries: [
                                            [
                                                    text: [
                                                            title:

[

query: query.toLowerCase(),

boost: 4
]
]
],
[
text: [

keywords: [

query: query.toLowerCase(),

boost: 3
]
]

                                            ],
                                            [
                                                    text: [

description: [

query: query.toLowerCase(),

boost: 2
]
]

                                            ]

                                    ]
                            ]
                    ],
                    should: [

                            range: [
                                    dateCreated: [
                                            boost: 5,
                                            gte: jodaThen
                                    ]
                            ],


                            range: [
                                    dateCreated: [
                                            lt: jodaThen,
                                            boost: 1
                                    ]
                            ]

                    ]
            ]
    ]]

--Adrian

Hi Adrian,
I am also interested in boosting my results by more recent date, this
is, modifying they score so as to newer documents have a slightly
bigger score than older ones
(notice that I don't mean sorting by
date
). But I am using the API (curl ...). I was thinking abut opening
a new issue but just seen yours.
I dont know even which tool should I use to achieve it. I have made
some testing with custom score but the performance is very poor. I see
that you are using dis_max and tie_breaker. Could you explain it a
little?

Thanks in advance!

Tania

On 4 ago, 00:23, Adrian adrian.ros...@gmail.com wrote:

Hi, trying to do a query against 3 fields, and then boost by more
recent date. The query executes ok, but it seems like none of the
boosting is really working. Any help appreciated. Here's my code:
(groovy code)

DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
DateTime dt = new DateTime(new Date());
dt = dt.minusDays(30)
String jodaThen = fmt.print(dt)

    def bodyContent = [query: [

            bool: [
                    must: [
                            dis_max: [
                                    tie_breaker: 0.7,
                                    boost: 1.2,
                                    queries: [
                                            [
                                                    text: [
                                                            title:

[

query: query.toLowerCase(),

boost: 4
]
]
],
[
text: [

keywords: [

query: query.toLowerCase(),

boost: 3
]
]

                                            ],
                                            [
                                                    text: [

description: [

query: query.toLowerCase(),

boost: 2
]
]

                                            ]

                                    ]
                            ]
                    ],
                    should: [

                            range: [
                                    dateCreated: [
                                            boost: 5,
                                            gte: jodaThen
                                    ]
                            ],

                            range: [
                                    dateCreated: [
                                            lt: jodaThen,
                                            boost: 1
                                    ]
                            ]

                    ]
            ]
    ]]

--Adrian

Hard to tell from the code in the mail, but can you use explain on the
search request which should provide more information on how the scoring of
each doc was computed.

On Thu, Aug 4, 2011 at 1:23 AM, Adrian adrian.roston@gmail.com wrote:

Hi, trying to do a query against 3 fields, and then boost by more
recent date. The query executes ok, but it seems like none of the
boosting is really working. Any help appreciated. Here's my code:
(groovy code)

DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
DateTime dt = new DateTime(new Date());
dt = dt.minusDays(30)
String jodaThen = fmt.print(dt)

   def bodyContent = [query: [

           bool: [
                   must: [
                           dis_max: [
                                   tie_breaker: 0.7,
                                   boost: 1.2,
                                   queries: [
                                           [
                                                   text: [
                                                           title:

[

query: query.toLowerCase(),

boost: 4
]
]
],
[
text: [

keywords: [

query: query.toLowerCase(),

boost: 3
]
]

                                           ],
                                           [
                                                   text: [

description: [

query: query.toLowerCase(),

boost: 2
]
]

                                           ]

                                   ]
                           ]
                   ],
                   should: [

                           range: [
                                   dateCreated: [
                                           boost: 5,
                                           gte: jodaThen
                                   ]
                           ],


                           range: [
                                   dateCreated: [
                                           lt: jodaThen,
                                           boost: 1
                                   ]
                           ]

                   ]
           ]
   ]]

--Adrian