[opencms-dev] Quering SOLR

Daniel Seidel d.seidel at alkacon.com
Tue May 24 16:27:28 CEST 2022


Hi Ramon,

it's a bit tricky, but this should work:

fq=parent-folders:("/Folder1/" AND -\/Folder1\/*\/)

The idea is to get all documents having the folder you want, but none 
having a subfolder of it in the parent-folders field.

For the subfolder match we need the wildcard "*". But that does not work 
in quoted strings. That's why we have to use the unquoted version and 
escape the "/" via "\" (URL-Encoded "%5C".

I hope that helps.

Best, Daniel.

Am 24.05.22 um 13:27 schrieb Filip Kratochvil via opencms-dev:
> Hello Ramon,
>
> i think you should use negative "-" symbol to exclude specific values:
> https://solr.apache.org/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-TheBooleanOperator-
>
> Something like that:
> fq=parfents-folders:”/Folder1/” - "\Subfolder1\"
>
> Let me know if it works, I'm interested :)
>
> Regards
> Filip Kratochvil
>
>
> po 23. 5. 2022 v 16:24 odesílatel Ramon Gavira Sáenz via opencms-dev 
> <opencms-dev at opencms.org> napsal:
>
>     Hello, Got a question about SOLR
>
>     Imagine a VFS  structure like:
>
>     \Folder1\
>
>     R1
>
>     R2
>
>     R3
>
>     \Subfolder1\
>
>     S1
>
>     S2
>
>     S3
>
>     If I ask solr like this: fq=parfents-folders:”/Folder1/” It
>     returns all resources (6 elements R* and S*)
>
>     How can I get only the resources in folder1, not in Subfolder1
>     (R1, R2, R3)??
>
>     Thanks!!
>
>     _______________________________________________
>     This mail is sent to you from the opencms-dev mailing list
>     To change your list options, or to unsubscribe from the list,
>     please visit
>     https://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> https://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
-- 
Kind Regards

Daniel.

-------------------

Daniel Seidel
Alkacon Software GmbH & Co. KG - The OpenCms Experts
https://www.alkacon.com  -http://www.opencms.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20220524/79d9c29b/attachment.htm>


More information about the opencms-dev mailing list