Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to this <a href="http://framework.zend.com/manual/1.12/en/zend.search.lucene.query-language.html#zend.search.lucene.query-language.escaping" rel="nofollow">page</a> list of special characters is as follows:</p> <pre><code>+ - &amp;&amp; || ! ( ) { } [ ] ^ " ~ * ? : \ </code></pre> <p>So you shouldn't have to escape <code>#</code>. But even if you don't use escaping 'slash' you will still get 0 results. You can't fix this behaviour even when you change <code>Text</code> field type to <code>Keyword</code>.</p> <p>So I started investigating on it and run this piece of code:</p> <pre><code>echo('&lt;pre&gt;'); var_dump(Zend_Search_Lucene_Search_QueryParser::parse("#")); echo('&lt;/pre&gt;'); die(); </code></pre> <p>It returned <code>Zend_Search_Lucene_Search_Query_Boolean</code> object with one subquery of <code>Zend_Search_Lucene_Search_Query_Preprocessing_Term</code> type. And what is funny, according to <a href="http://framework.zend.com/apidoc/1.9/Zend_Search_Lucene/Search/Zend_Search_Lucene_Search_Query_Preprocessing_Term.html" rel="nofollow">documentation</a>:</p> <blockquote> <p>It's an internal abstract class intended to finalize ase a query processing after query parsing.</p> <p>This type of query <strong>is not</strong> actually <strong>involved into query execution</strong>.</p> </blockquote> <p>So the only thought I had was: DO NOT USE DEFAULT PARSER ANYMORE!</p> <p>So I thought that the solution for your problem is simple - create query manually using <a href="http://framework.zend.com/manual/1.12/en/zend.search.lucene.query-api.html" rel="nofollow">query construction API</a>:</p> <pre><code>$term = new Zend_Search_Lucene_Index_Term("#"); $query = new Zend_Search_Lucene_Search_Query_Term($term); /* still returns 0 results!! */ $r = $index-&gt;find($query); echo('&lt;pre&gt;'); var_dump(count($r)); echo('&lt;/pre&gt;'); </code></pre> <p>But it's NOT working again!</p> <p>The only way I made it working (with query parser as well) was by adding this line:</p> <pre><code>-&gt;addField(Zend_Search_Lucene_Field::keyword('content-03', '#')) </code></pre> <p>So assuming: special characters can only be searched as keywords, as these fields are not tokenized. But keywords are treated as a whole phrase (even with phrases inside), and this is huge limitation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload