I have many node titles that have apostrophes in them like "Bob's Store" -- so when my users type in bobs store, it doesnt show up because they forgot the apostrophe. Is it possible to ignore these?

Comments

danielb’s picture

Here are my thoughts

- For optimal querying you would want the data you are searching for to be indexed. So you might use a Computed Field CCK field to a store a copy of the node title without punctuation, and find by both fields. This is something you can do without me making any upgrades to the module.

- By creating a new feature in this module, it might be possible to apply a function in sql to make these replacements on the fly, but it does come with a performance hit.

- Perhaps supporting sql functions is a good idea because we can then start to implement things like levenshtein and soundex, which would help with typos and homophones

danielb’s picture

On second thoughts the first option I gave won't be suitable, because you will see each node title twice in the suggestion list.

j0k3z’s picture

Thanks for the suggestions. Maybe the best way is just an sql query that deletes all of the apostrophes altogether? Do you know of an easy way to do that or would I have to just do it manually?

danielb’s picture

I'm not sure what you mean, you could still use a computed field to store a version of the node title without punctuation (you would have to work out the PHP to do this) and then use the computed field instead of the node title. However then you have the opposite problem of a user typing the apostrophe in and not finding the record.

danielb’s picture

Perhaps we need a way for people write in their own function calls on the values that are being compared.

Consider this query:

SELECT title, nid FROM node WHERE title LIKE "%bobs store%"

specifically the title LIKE "%bobs store%" part is in the format field OPERATOR value

so imagine a textbox or something in the config of the finder that actually says "field operator value" and you can change it to "REPLACE(field, "'", "") OPERATOR REPLACE(value, "'", "")" which would ultimately make the query condition REPLACE(title, "'", "") LIKE REPLACE("%bobs store%", "'", "") which would work for you -- I think.

Just an idea at this stage

j0k3z’s picture

Couldnt it just be coded into the module somehow at all times? I imagine you would always want to return results both with/without apostrophes, right?

danielb’s picture

It shouldn't be hardcoded in because it slows down the query, may not apply to all kinds of fields (you wouldn't perform this function on a Node ID because it would never have an apostrophe - so it's wasted time), and so far you're the only person that has asked for it.

j0k3z’s picture

Good points. In that case I guess a textbox or something in the config of the finder like you suggested might be a good start.

j0k3z’s picture

So is there any way to *ignore* punctuation in node titles?

I have nodes like

Mr. Reds Coffee
John's Pizza
etc

A lot of people search Mr Reds and dont put the (.) in so the node never shows up in the drop down. It would be great if they could type the period or ignore it and still get the same results.

danielb’s picture

Category: support » feature

No there's not a way to do this, someone will have to figure out how to do it :/

danielb’s picture

Component: Finder Search » Code
Status: Active » Postponed
danielb’s picture

Status: Postponed » Closed (duplicate)

I am closing this issue and creating a new one for advanced text matching
#998650: Advanced text comparison