You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dirk Högemann <di...@googlemail.com> on 2012/11/01 21:02:37 UTC

Re: Forwardslash delimiter.Solr4.0 query for path like /Customer/Content/*

Ok.If there is no other way I will have some string parsing to do, but in
this case I am wondering a little bit about the chosen delimiter...as it is
central to nearly any path in directories, web resources etc.,right?
Best
Dirk
Am 30.10.2012 19:16 schrieb "Jack Krupansky" <ja...@basetechnology.com>:

> Maybe a custom search component that runs before the QueryComponent and
> does the escaping?
>
> -- Jack Krupansky
>
> -----Original Message----- From: Dirk Högemann
> Sent: Tuesday, October 30, 2012 1:07 PM
> To: solr-user@lucene.apache.org
> Subject: Forwardslash delimiter.Solr4.0 query for path like
> /Customer/Content/*
>
> Hi,
>
> I am currently upgrading from Solr 3.5 to Solr 4.0
>
> I used to have filter-bases restrictions for my search based on the paths
> of documents in a content repository.
> E.g.  fq={!q.op=OR df=}folderPath_}/customer/**content/*
>
> Unfortunately this does not work anymore, as lucene now supports
> Regexpsearches - delimiting the expression with forward slashes:
> http://lucene.apache.org/core/**4_0_0-BETA/queryparser/org/**
> apache/lucene/queryparser/**classic/package-summary.html#**Regexp_Searches<http://lucene.apache.org/core/4_0_0-BETA/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Regexp_Searches>
>
> this leads to a parsed query, which is of course not what is intended:
>
> <arr
> name="parsed_filter_queries"><**str>RegexpQuery(folderPath_:/**
> standardlsg/)
> folderPath_:shareddocs RegexpQuery(folderPath_:/**personen/)
> folderPath_:*</str></arr>
>
> Is there a possibility to make the example query above work, without
> escaping the "/" with "\/"?
> Otherwise I will have to parse all queries  (coming from persisted
> configurations in the repositiory) and escape the relevant parts of the
> queries on that field, which is somewhat ugly...
>
> The field I search on is of type:
>
> <analyzer type="index">
>        <tokenizer class="solr.**KeywordTokenizerFactory"/>
>        <filter class="solr.**LowerCaseFilterFactory"/>
>      </analyzer>
>      <analyzer type="search">
>        <tokenizer class="solr.**KeywordTokenizerFactory"/>
>        <filter class="solr.**LowerCaseFilterFactory"/>
> </analyzer>
>
> Best and thanks for any hints
> Dirk
>

Re: Forwardslash delimiter.Solr4.0 query for path like /Customer/Content/*

Posted by Jack Krupansky <ja...@basetechnology.com>.
It would be nice to be able to customize or even disable features like this. 
Same goes for wildcards. But... feel free to propose something!

-- Jack Krupansky

-----Original Message----- 
From: Dirk Högemann
Sent: Thursday, November 01, 2012 4:02 PM
To: solr-user@lucene.apache.org
Subject: Re: Forwardslash delimiter.Solr4.0 query for path like 
/Customer/Content/*

Ok.If there is no other way I will have some string parsing to do, but in
this case I am wondering a little bit about the chosen delimiter...as it is
central to nearly any path in directories, web resources etc.,right?
Best
Dirk
Am 30.10.2012 19:16 schrieb "Jack Krupansky" <ja...@basetechnology.com>:

> Maybe a custom search component that runs before the QueryComponent and
> does the escaping?
>
> -- Jack Krupansky
>
> -----Original Message----- From: Dirk Högemann
> Sent: Tuesday, October 30, 2012 1:07 PM
> To: solr-user@lucene.apache.org
> Subject: Forwardslash delimiter.Solr4.0 query for path like
> /Customer/Content/*
>
> Hi,
>
> I am currently upgrading from Solr 3.5 to Solr 4.0
>
> I used to have filter-bases restrictions for my search based on the paths
> of documents in a content repository.
> E.g.  fq={!q.op=OR df=}folderPath_}/customer/**content/*
>
> Unfortunately this does not work anymore, as lucene now supports
> Regexpsearches - delimiting the expression with forward slashes:
> http://lucene.apache.org/core/**4_0_0-BETA/queryparser/org/**
> apache/lucene/queryparser/**classic/package-summary.html#**Regexp_Searches<http://lucene.apache.org/core/4_0_0-BETA/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Regexp_Searches>
>
> this leads to a parsed query, which is of course not what is intended:
>
> <arr
> name="parsed_filter_queries"><**str>RegexpQuery(folderPath_:/**
> standardlsg/)
> folderPath_:shareddocs RegexpQuery(folderPath_:/**personen/)
> folderPath_:*</str></arr>
>
> Is there a possibility to make the example query above work, without
> escaping the "/" with "\/"?
> Otherwise I will have to parse all queries  (coming from persisted
> configurations in the repositiory) and escape the relevant parts of the
> queries on that field, which is somewhat ugly...
>
> The field I search on is of type:
>
> <analyzer type="index">
>        <tokenizer class="solr.**KeywordTokenizerFactory"/>
>        <filter class="solr.**LowerCaseFilterFactory"/>
>      </analyzer>
>      <analyzer type="search">
>        <tokenizer class="solr.**KeywordTokenizerFactory"/>
>        <filter class="solr.**LowerCaseFilterFactory"/>
> </analyzer>
>
> Best and thanks for any hints
> Dirk
>