When I search for special characters such as "#" no results come up.
Note that I have escaped the query string.
However, when combined with a letter like "c#" Lucene finds the term.
Is there any way to search for single special characters?
Here's my snippet:
Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(1);
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
new \Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
$index = Zend_Search_Lucene::create('/tmp/index');
$doc = new Zend_Search_Lucene_Document;
$doc->addField(Zend_Search_Lucene_Field::Text('title', 'Some Title Here', 'UTF-8'))
->addField(Zend_Search_Lucene_Field::Text('content-01', '+ @ #', 'UTF-8'))
->addField(Zend_Search_Lucene_Field::Text('content-02', 'C+ C#', 'UTF-8'));
$index->addDocument($doc);
$index->commit();
/* returns 0 results */
$r = $index->find("/#");
echo count($r) . "\n";
/* returns 1 results */
$r = $index->find('C#');
echo count($r) . "\n";
/* returns 1 results */
$r = $index->find('C+');
echo count($r) . "\n";
$index->find('C');
returns any results – Nandakumar V