Re: ft:query facets and options

Gus Riva <[email protected]>
Newsgroups gmane.text.xml.exist
Message-ID <CAG92wEd7C_FwiX_kXruqo-Lkdtx1ZSO0DLh94pSzC_Tv46z3xA@mail.gmail.com>
Thanks, Boris!

That is exactly what I was looking for. I have something like this and it
works:

$query_options := map {
"facets": map {
"script": ($scriptParam),
"condition": ($conditionParam),
},
"fields": ('place', 'material'),
"leading-wildcard": "yes"
}

On Fri, Feb 24, 2023 at 4:11 PM Boris Lehečka <[email protected]> wrote:

>     Hello Gus,
>
>     take a look at
> https://github.com/eeditiones/tei-publisher-app/blob/master/modules/query.xql,
> TEI Publushers uses json format for options, as you can see here
>
>     declare variable $query:QUERY_OPTIONS := map {
>     "leading-wildcard": "yes",
>     "filter-rewrite": "yes"
>     };
>
>     and here:
>
>     declare function query:options($sortBy as xs:string*) {
>     map:merge((
>         $query:QUERY_OPTIONS,
>         map {
>             "facets":
>                 map:merge((
>                     for $param in
> request:get-parameter-names()[starts-with(., 'facet-')]
>                     let $dimension := substring-after($param, 'facet-')
>                     return
>                         map {
>                             $dimension: request:get-parameter($param, ())
>                         }
>                 ))
>         },
>         if ($sortBy) then
>             map { "fields": ($sortBy, $config:default-fields) }
>         else
>             map { "fields": $config:default-fields }
>         ))
>     };
>
>    I would also prefer the <option> in XML, maybe someone else can help.
>
>     Boris
> Dne 24.02.2023 v 15:11 Gus Riva napsal(a):
>
> Hi!
>
> Hope someone can help me. I am trying to do a full text query using the
> lucene index with facets and ft:query. The documentation says that the 3°
> parameter in the query can be the options as an xml fragment. For example:
> let $options := <options> <query-analyzer-id>ws</query-analyzer-id> <
> default-operator>and</default-operator> <phrase-slop>1</phrase-slop> <
> leading-wildcard>no</leading-wildcard> <filter-rewrite>yes</filter-rewrite
> > <lowercase-expanded-terms>yes</lowercase-expanded-terms> </options>
>
> Described here:
>
> https://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/lucene&location=java:org.exist.xquery.modules.lucene.LuceneModule#query.3
>
> And towards the end of:
> https://exist-db.org/exist/apps/doc/lucene
>
> This is however not working for me.
> The 3° parameter of ft:query can also be used with a map for facets and
> fields, described also in the documentation. Like this:
> let $options := map { "facets": map { "keyword": ("indexing", "facets"),
> "date": [("2018", "06"), ("2018", "05")] } }
>
> This works for me.
>
> Ideally, I would like to do both: use the facets and fields argument, and
> change the options. Is there a way to do that? Has the options function
> been deprecated?
>
> Thanks for your help!
>
> Best,
> Gustavo Fernández Riva
> Universität Heidelberg
>
>
> _______________________________________________
> Exist-open mailing [email protected]://lists.sourceforge.net/lists/listinfo/exist-open
>
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.