Spica Posted January 4, 2016 Share Posted January 4, 2016 I have question on organizing a search. e.g. the skyscraper demo. If searched with "nyc" first entry is "33 Thomas Street". If I search "nyc thomas" I get no result. Because the phrase is split over two fields. But I would have expected to reduce the result list. Is it possible to cover this scenario? Link to comment Share on other sites More sharing options...
Tom. Posted January 4, 2016 Share Posted January 4, 2016 Hello, I recently came across this. However I used a very different method than the example I'm going to attempt because I was matching tags. Basically I would get a match on "Disability Act" but not "How to help with Disability". Because it was looking for something that contained all the connectives "How to help with" however as the search engine, I was only interested in the "Disability" part. For this I would try (please bare in mind I don't know the templates/fields): $selector = ""; $search = explode(" ", $input->get->search); foreach($search as $result) { $selector .= ", (field1|field2=$result)" } $pages->find("template=skyscraper" . $selector); However this wouldn't take put the result higher up if it had "Thomas" in the address and the area as "NYC" it would pick one and return results based on that. I would love to know how to do the search based on most matched phrases. However I have no idea how to do that. Maybe someone far smarter than me could tell you how to do that in ProcessWire 1 Link to comment Share on other sites More sharing options...
Spica Posted January 5, 2016 Author Share Posted January 5, 2016 thanks for your reply, Tom. I think that pointed me the right way. I am now testing grouping of selectors. Your suggestion combined with a second group should to the job. (Hopefully it doesnt fail proof). Even if it does not fullfill a hundred percent it is an improvement So this is my selector (field1|field2~=phrase-full),(field1|field2=phrase-segment1),(field1|field2=phrase-segment2), ... 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now