Comments

anrikun’s picture

Status: Active » Needs review
StatusFileSize
new545 bytes

Quick fix attached.

neograph734’s picture

Status: Needs review » Reviewed & tested by the community

Just tested this, and works perfectly :)

neograph734’s picture

Status: Reviewed & tested by the community » Needs work

Well, I need to correct my previous comment. It indeed supresses the error. But the percentage column remains empty, and no search results are generated. So it's not a fix for the problem.

neograph734’s picture

Status: Needs work » Needs review
StatusFileSize
new890 bytes

After a quick scan of the module and the database I found the column name is not 'percentage', but it's 'completeness'. I've fixed that in the attached patch.
It still threw an error on en empty search-string, but anrikun's patch solved that issue.

dolcaer’s picture

Seems to be working great over here! Thanks!

dolcaer’s picture

Status: Needs review » Reviewed & tested by the community

Forgot to change status to reviewed&tested, and couldn't edit my previous post.

anrikun’s picture

Status: Reviewed & tested by the community » Needs work

Hi Neo,
As for me, column name is 'percent'.
See this example of query generated by the module:

SELECT t.item_id AS item_id, SUM(t.score) AS score, SUM(percent) AS percent
FROM 
(SELECT t.*, SUM(t.completeness) AS percent
FROM 
{fuzzysearch_default_fuzzysearch_index_title} t
WHERE (( (ngram = 'duc') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'uco') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'cos') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'duc') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'uco') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'cos') AND (completeness >= '20.000') AND (completeness <= '100.001') ))
GROUP BY t.word_id, t.item_id
HAVING  (SUM(t.completeness) >= '40')  UNION ALL SELECT t.*, SUM(t.completeness) AS percent
FROM 
{fuzzysearch_default_fuzzysearch_index_search_api_viewed} t
WHERE (( (ngram = 'duc') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'uco') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'cos') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'duc') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'uco') AND (completeness >= '20.000') AND (completeness <= '100.001') )OR( (ngram = 'cos') AND (completeness >= '20.000') AND (completeness <= '100.001') ))
GROUP BY t.word_id, t.item_id
HAVING  (SUM(t.completeness) >= '40') ) t
GROUP BY t.item_id
ORDER BY percent DESC, score DESC
LIMIT 10 OFFSET 0

Available columns are: item_id, score, percent

neograph734’s picture

Ah, my bad... I looked into the database and found completeness. It did remove the errors and provided sorted results... Well, adding the score as a filter works too. Forget my patch.

neograph734’s picture

Issue summary: View changes

Added a better description

firesidelibrarian’s picture

I ran patch #1 but not #4, as the comments above indicate to do, but am still getting the error message.

Update: I used incorrect syntax for installing the patch. Reinstalled module, applied patch, now not getting SQL error. Thanks for making it available!

gChen07’s picture

sorry but I cannot not help in testing the patch, I'm still studying how to apply them. Is it possible to include the patch on the next release of this module, even in dev version?

firesidelibrarian’s picture

Hey gChen07,
I was uncertain how to apply patches as well, but found it not as hard as expected.
There are some clear online instructions here that explain how to do it. Here's how I did it:

  1. Upload the patch to the sites/all/modules/fuzzysearch directory using an FTP program such as Filezilla or Dreamweaver
  2. In a terminal window, type the following command:

patch -p1 < fuzzysearch_unknown_column_percent_quick_fix-2011768-1.patch

You should get a message that reads 'patching file includes/service.inc'.

Patch applied!

Paul B’s picture

I get this error (Unknown column 'percent') on the fuzzysearch index admin page after upgrading search api from 7.x-1.8 to 7.x-1.10. The patch in #1 seems to fix it.

Anonymous’s picture

Works for me.

anrikun’s picture

Issue summary: View changes
Status: Needs work » Needs review
lisagodare’s picture

I've also been getting this error, whether or not sorting by score was selected. I expanded on the patch in #1 to add the percent expression, if possible, and verifying it's presence before attempting to sort by it.

ken hawkins’s picture

Just a quick chime in that the latest patch by @faerysteel is treating us well.

dlx’s picture

Applied #15 - works well so far.

hmartens’s picture

Thanks for #15 ...the patch worked beautifully!

dshields’s picture

Status: Needs review » Reviewed & tested by the community

This works perfectly for me, too - RTBC

nevergone’s picture

whitespace errors fixed:

fuzzysearch-unknown_column_percent_add_expression_before_sort-2011768-15.patch:12: trailing whitespace.

fuzzysearch-unknown_column_percent_add_expression_before_sort-2011768-15.patch:18: trailing whitespace.
}
fuzzysearch-unknown_column_percent_add_expression_before_sort-2011768-15.patch:41: trailing whitespace.

warning: 3 lines add whitespace errors.

nevergone’s picture

nevergone’s picture

mandreato’s picture

Encountered the error after activation of bundle filter on the index.
Patch #20 resolved it !

dooug’s picture

Was able to replicate the issue on a fresh D7 site. Had to create some dummy content to index. This is an export of my view.

I got the error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'percent' in 'order clause' as described.

As well as the following error when I was re-indexing the content:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'percent' in 'order clause': SELECT t.item_id AS item_id, :score AS score FROM {fuzzysearch_default_fuzzysearch_index_search_api_language} t ORDER BY percent DESC, score DESC LIMIT 0 OFFSET 0; Array ( [:score] => 1 ) in FuzzySearchService->search() (line 716 of /var/www/sites/default-d7.dev/www/sites/all/modules/contrib/fuzzysearch/includes/service.inc).

Applying the patch resolved the errors. I re-rolled the patch and modified the comments a bit for readability. See this interdiff for changes.

nicholasruunu’s picture

Is this project abandoned or something?

This bug was reported over a year ago and solutions have been offered.
Does nobody want to maintain this project any more?

lisagodare’s picture

nicholasruunu:
Maintenance status: Seeking new maintainer

jagadeeshramuj’s picture

I am very much interested to maintain this project, kindly let me know your opinion.

neograph734’s picture

@jagadeeshramuj, please contact the current maintainer(s) directly via the contact link on their profiles.

awolfey’s picture

Please see this #2572045: Seeking new maintainer for Fuzzysearch for discussing new maintainers. Thanks.

  • jagadeesh javvadi committed 32bccea on 7.x-1.x
    Issue #2011768 by jagadeeshramuj: Unknown column percent add expression...
jagadeeshramuj’s picture

jagadeeshramuj’s picture

Status: Reviewed & tested by the community » Closed (fixed)