AnsweredAssumed Answered

Search bug?

Question asked by marcus on Oct 18, 2006
I've got a customised advanced search page jsp and bean which I use to search on a couple of custom properties (and adds a few things to make it a bit more GET friendly). When I search using the custom property, I don't receive any results (even though I have documents with that property set), so I dumped the result of the SearchContext.buildQuery method, and got the following as part of the generated query


@\{http\://www.lateralminds.com.au/model/name/1.0\}jurisdiction:Australia*

I notice the Wiki page http://wiki.alfresco.com/wiki/Search#Finding_nodes_by_text_property_values indicates you can search for text properties without using quotes around the subject, but trying just this portion of the query in the node browser with a lucene search returns nothing. Attempting the same search but with quotes around the subject works exactly as expected, ie


@\{http\://www.lateralminds.com.au/model/name/1.0\}jurisdiction:'Australia*"

and the documents I expect to have returned are returned.

I've tried a few other searches on properties without using quotes, and can't get any of them to work, and as soon as I add the quotes the results appear as expected. Near as I can tell, the following needs to be tweaked…


SearchContext.buildQuery() : 319

            String value = queryAttributes.get(qname).trim();
            if (value.length() != 0 && value.length() >= minimum)
            {
               String escapedName = Repository.escapeQName(qname);
               attributeQuery.append(" +@").append(escapedName)
                             .append(":")[b].append("\"")[/b].append(QueryParser.escape(value)).append(OP_WILDCARD)[b].append("\"")[/b];
            }

Outcomes