MySQL Full Text Search not returing all records - mysql

First time implementing Full Text Search...
I've run the necessary ALTER TABLE SQL to enable FULLTEXT on the applicable tables/fields.
On the following beta site: http://wtc.betaforming.com/
If I do a search for "leadership", I get normal results except for the Events section at the bottom. I have Events with that word in the event title and throughout the description copy (http://wtc.betaforming.com/events/event/?event_id=10039).
If I do a search for "communications", I get results in the Events section, which makes me think I have everything configured correctly.
I'm using the following basic code for testing purposes:
SELECT *
FROM tblevents
WHERE MATCH(event_title, event_desc_long, event_desc_short, event_tab_one_title, event_tab_one_text, event_tab_two_title, event_tab_two_text, event_tab_three_title, event_tab_three_text, event_tab_four_title, event_tab_four_text) AGAINST ('$site_search_term')
This is the same code I'm using to search Products and Articles (changing the necessary FROM and WHERE information).
Not sure what is happening (since it works for some phrases) or where to start looking in my db to see what is wrong.
Thanks
Brett

The answer to my question can be found here:
http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html
My search term was over the 50% threshold - you have to read all the way to the bottom to find this.
I've implemented the "IN BOOLEAN MODE" for my events search and everything appears to be working correctly. I also used this article for help:
http://devzone.zend.com/26/using-mysql-full-text-searching/

Related

Google sheets importxml failure - Can't find the correct path to table from the link

I'm trying to retrieve a table which is updating twice per day. On other websites i was able to find the element but i saw that the way i see don't work on all websites where i tried.
In this case the issue is:
In google sheets using importxml, i can't find the correct path to table from the link or identify the element.
The website for this example is: http://lotopolonia.com/tabel/arhiva/index.php
1. I need to retrieve the dates and numbers.
2. They are updated twice per day and being updated in my sheet with adding just the last line at the top of the others. But this one after i solve the first one.
I looked at xpath tutorial from w3c and understood the syntax a bit.
The problem is how to identify correctly the elements and nodes in the inspector to retrieve the data i need.
Also, i've installed a chrome extension (XPath Helper) which shows xpath better that what i got from chrome.
I tried the following:
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row']/td[#class='colon2']")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row']/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='first_row'][1]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//*[#class='table_01']/table/tbody/tr[#class='first_row'][1]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[3]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[*]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row'][1]/child::td[*]")
The formula looks ok, without errors, but at all above requests i get the same result: imported content is empty
Unfortunately i ran out of ideas and how to interpret that elements...
Any ideea how to go on?
Cheers
How about this answer? I used //table[#class='table_01']/tr[position()>2] as a xpath. "A1" has http://lotopolonia.com/tabel/arhiva/index.php.
=IMPORTXML(A1,"//table[#class='table_01']/tr[position()>2]")
Using table[#class='table_01'], retrieve the table.
Using tr[position()>2], retrieve the dates and numbers.
Result :
Note :
If you want to retrieve the whole table, please use =IMPORTXML(A1,"//table[#class='table_01']/tr").
If this was not what you want, I'm sorry.

Wikimedia Commons query stopped working

I had this url for photo searches on Wikimedia Commons :
https://commons.wikimedia.org/w/api.php?
action=query&
prop=imageinfo|categories&
generator=search&
gimlimit=10&
gsrsearch=File:"${title}"&
iiprop=extmetadata|url&
iiextmetadatafilter=ImageDescription|ObjectName&
gsrnamespace=6&
format=json&
origin=*
where ${title} is the search term. It was working beautifully. All of a sudden now it stopped working. I get this error:
Unrecognized parameter: gimlimit
I tried taking that parameter out and now nothing gets returned at all. This used to work. What has changed?
Parameter names look like ['g' for generator][module prefix][base parameter name]. So if you want to limit the number of search results, that would be gsrlimit. If you want to limit the number of image revisions to return info for per search result, that would be iilimit (it defaults to 1 though so you probably don't need to change it).
As you can see from your own link, you go get results (and removing gimlimit does not change anything, beyond the warning not showing up).

Wikipedia api fulltext search to return articles with title, snippet and image

I've been looking for a way to query the wikipedia api based on a search string for a list of articles with the following properties:
Title
Snippet/Description
One or more images related to the article.
I also have to make the query using jsonp.
I've tried using the list=search parameter
http://en.wikipedia.org/w/api.php?action=query&list=search&prop=images&format=json&srsearch=test&srnamespace=0&srprop=snippet&srlimit=10&imlimit=1
But it seems to ignore the prop=images, I've also tried variations using the prop=imageinfo and prop=pageimages. But they all give me the same result as just using the list=search.
I've also tried action=opensearch
http://en.wikipedia.org/w/api.php?action=opensearch&search=test&limit=10&format=xml
Which gives me exactly what I want when i set format=xml, but returns a simple array of page titles when using format=json and therefore fails because of the jsonp requirement.
Is there another approach to doing this? I'd really like to solve this in a single request rather than make the first search request and then a second request for the images using titles=x|y|z
As Bergi suggested, using generators is the way to go here. Specifically what I would do:
use list=search as a generator, to get the list of articles
use prop=pageimages to get a representative image for each article
use prop=extracts to get a description for each article
The whole query could look like this:
http://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrsearch=test&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max
I've tried using the list=search parameter, but it seems to ignore the prop=images
If you want to retrieve any properties, you need to specify a list of pages for which you want to get these; e.g. by using the titles=, pageids=, or revids= parameters. You didn't send any, so you did not get a result for the prop=images.
If you did use api.php?action=query&list=search&srsearch=test&prop=images&titles=test you would have gotten the search results for test and the images of the Test page.
You can however also use the collection that the list query generates for your property query, using the list module as a generator. The query would look like
api.php?action=query&generator=search&gsrsearch=test&gsrnamespace=0&gsrprop=snippet&prop=images. Unfortunately, it does not yield the attributes that the list contained, but only used the pageids for a basic property query.
Using two queries is probably the way to go. Btw, I'd recommend to use the pageimages property, it will likely give you the best results.

PHPMyAdmin alert box - missing value in the form - all usual fields are filled out?

For some reason while using PHPMyAdmin and attempting to save a table, even though I've entered all of the information I usually do I'm getting an alert box popping up with the content "Missing value in the form!".
Here's a screenshot of my PHPMyAdmin console (2 screens merged due to resolution):
PHPMyAdmin Create Table Modal Box
What I've tried so far:
Changing the data types all to VARCHAR with a length of 255 (except for the deindeal_id column, which remained INT with a length of 12).
Encasing description in "`" (bacticks), thinking it may be a reserved word of some sort.
Adding a coalition.
Using different table engines (InnoDB, MyISAM (the one I wanted)).
I'm really stumped as to what could be causing this issue, so any answers would be greatly appreciated!
Looks like a bug. Try going to Settings -> Features -> General tab and disable Ajax.
Then, try to create a new table and it won't use the popup.
I had this issue with the SQL form (where you can paste larger blocks of MySQL code). Not sure if it's a fluke, but I selected all of my input and then hit Go..and it worked.
Did you give it a table name.
I had the same problem & I simply forgot to give it a table name...at the top.
Got the same error, probably a Bug.
What Lex said: "Maybe if you define a column NOT NULL (ie. don't check the box in the Null column, you have to define a default value? – Lex 20 hours ago"
Nope. Doesn't work either and wouldn't make much sense. If you don't define a default value, the server will either insert an empty string, or fail the query; depending on settings.
I just encountered this....
It turns out I was forgetting to provide a name for the new table....
It's a bug I also "met" on phpMyAdmin v.3.5.1 - Disabling Ajax (and by default I love to disable it) will do the job.
Stop & start MySQL service. You can create table.
Yes It's a bug. what I did is to stop xampp (or if you're using wampp),
and then start them again. after that you will be able to create the table in phpMyAdmin
You can also try USE databasename; at the top of your query. In some versions this error seem to happen even if you did select your database, USE databasename; will fix this bug in those situations.
I just encountered this in 4.1.11. Seems to be a bug (again?). Disabling the popup and switching to the original theme resolved it somewhat for me, although you'll be without the popup which is a pain in the behind.
Switch back to Original theme:
Home > Theme: "Original"
Disable the popup:
Home > More settings > SQL queries > Disable: "Edit in window"
I got this problem too and I had opened same database in phpmyadmin in two separate tabs of browser . When I closed one tab and access phpmyadmin, the problem disappeared.
Just to let you know folks. Turning off my AdBlock Plus finally solved it for me. No more Missing value in the form! pop-ups when trying to submit something. Whitelist phpMyAdmin domain in any style or script altering add-on you might use.

MySQL/PHP Autosuggest

In my MySQL DB I have a list of terms like this (With First letters Capital and most of the time plurals)
Hairdressers
Restaurants
Beauty Salons
Furnitures For Restaurants
On my website I have a search bar where the user can search for those word (my website is a kind of POI finder). The search bar has a auto-suggest function, but I'm having problems with my query.
SELECT * FROM TABLE WHERE word = 'userword%'
So if the user enter "Res" it will return all the word starting the "Res". Fair enough, that works, But in my DB i have also words with space between them (Furnitures For Restaurants) and I would like that if the user enter "Res" the mysql query ALSO return Furnitures For Restaurants. I have tried this
SELECT * FROM TABLE WHERE word = '%userword%'
Yes great this works, but... it is a bit to much relax.. it return all and everything, so if the user enters "a" it will return all the word having a in it... And I don't want this.
So how can make the query works only on the FIRST letters of each word ? Exactly like my first query but taking in consideration words with spaces?
Look into mysql FULL Text Search feature. Look at this article too, explains mysql full text searching in a very detailed way.