Gaining Access To How MySql Parses Text For Full Text
I want to gain access to the function or process MySql uses to parse words and phrases for Full Text searching. Here is an example.
If the user inputs...
Milan in history
MySql will search for milan, history, and milan history. Is there a way to extract just the combination of terms MySql uses to search the db without the stop words? Stop words are automatically eliminated from the search request unless the user encloses a phrase in quotes.
What I am trying to do is develop a script to highlight found search terms and phrases. I can explode a phrase into single words but if I do that the stop words would be included in the array. If there is some way of getting into the parsed words or phrases MySql Full Text actually uses to search, I can use each of those combinations as a keyword in my highlighting script.
This request is about searching for the code or any code related to the questions involved.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Full Text Search ( Mysql )
I was searching the sql man , for some good ways to search a mysql db. so i found that Full text search the best way is to go becease LIKE just gives to mutch output.PHP Code:
MySQL 5.0, FULL-TEXT Indexing And Search Arabic Data, Unicode
MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode [This version has a couple subtle edits from the orginial I posted on mailing.database.myodbc - I'm cross posting here on this topic/subject related newsgroup] I was wondering if anybody has experienced the same issues challenges I'm experiencing I'll describe shortly. Once resolved some fascinating and powerful multi-lingual apps incorporating non-English/latin character sets can be realized by many developers. I have a Unicode utf8 English - Arabic - Hebrew - Greek (and several other languages) database in Microsoft Excel. I KNOW that it is Unicode utf8 data because MySQL tells me it recognizes the encoding as such but not in the context I want. Allow me to explain ... I can search the Unicode utf8 encoding with no problem in Excel. While in Excel I highlight a complete word or a partial string of an Arabic word copy it to the clipboard (i.e. memory). I then do a find and the process is the same successful result as if it was an English string. MySQL 5.0 is supposed to handle Unicode utf8 I created a MySQL database I named: languages CREATE DATABASE languages ; and I implemented the following command on a MySQL command prompt: ALTER DATABASE languages DEFAULT CHARACTER SET utf8; No problem (so far) MySQL seemingly recognized utf8 and accepted it. My understanding is with the ALTER command the tables I create against languages will be utf8. I now created a table I named mainlang which denotes it will be the main table for my languages. mysql>CREATE TABLE mainlang ->( ->langNumID varchar(30), ->colB varchar(30), ->colC varchar(30), ->primary key (langNumID, colB) ->); Again so far no problem: Table successfully created. My third column 'colC' is where the Unicode data will be stored. I now attempt to import the database from my Excel file into my MySQL database as follows: mysql>load data infile 'c:arabicdictionary.csv' ->into table mainlang ->fields terminated by ',' ->lines terminated by ' ' ->(langNumID, colB, colC); ERROR 1406 (22001): Data too long for 'colC' at row 1 So what to do? I did a search and found other people seemingly had the same problem and someone suggested: ALTER DATABASE languages DEFAULT CHARACTER SET cp1250; I dropped mainlang, recreated it, redid the load and Lo and behold ... it seemed to work. No Data too long error occurred and when I did the following query: mysql>select langNumID, colB, colC ->from mainlang ->where colB = ��' I see colA have a correct numeric value, colB a correct numeric value (4994) and for colC a string of unintelligible characters with diacritical marks, oomlats etc. which I know is the cp1250 encoding interpretation of the Unicode utf8 data which is similarly unintelligible in its own regard. Now what I try is: do a copy of the obscure colC cp1250 character string into the clipboard/memory and then do the following tweak on the original select statement to see if I can search on the (now) cp1250 character string: mysql>select langNumID, colB, colC ->from mainlang ->where colc = 'paste of the cp1250 character string' The computer would not allow a paste unless I pressed the escape key. On initiating this select command I got an empty set (no match) My questions are: Has anyone been successful creating a Unicode utf8 MySQL database that accepts Arabic? If yes, how did you get around or not encounter the Data too long issue? Have you tried the cp1250 (or cp1251 - same mechanics same results) work around as I have? Are you able to search the cp1250 character string (my colC)? If yes, how did you successfully manage to do it? Lastly, if I take the cp1250 encoded string and paste it into Excel ... I can string search the cp1250 encoding with no problem. Also, here's how I know my Unicode utf-8 data is correct apart from my own manual cross-referencing and being recognized by MySQL in some respect: When I copy the Unicode utf8 encoding and try to paste it into the select command to see what would happen I get the following error: ERROR 1257 (HY000): Illegal mix of collations (cp1250_general_ci, IMPLICIT) and (utf8_general_ci, COERCIBLE) for operation '=' So what I have here is a situation where MySQL is recognizing Unicode utf8 encoding but not from the respect of packing a table! Go Figure ...
Full-text Indexing Of Pdf, Rtf, Txt, Html
I have a big pile of files on my local machine that are in a variety of formats - txt, rtf, pdf, html, etc. What I'm looking for is a script that will crawl through the files and perform simple full-text indexing on them, and will allow for queries to be executed on the index. I gave PHPDig a shot but it prefers web-based setups - my files are all stored locally and will only be accessed locally.
Full Text Search In PDF And Word Files ?
I need to perform full text searches on a batch of PDF and Word files. What is the best way to go? After some research, I'm thinking of extracting the plain text from the files with "pdftotext" and "catdoc", hamonizing the various possible encodings to UTF-8, storing the text in a MySQL database, and then using the full text search capabilities of MySQL. Do you think that would work well? I am told that the files are mostly text and won't be longer than 30 pages.
Full Text Search With Pagination Class
I've used the Full Text search example from this site and added the pagination class from http://www.goodphptutorials.com/article/show/simple-php-mysql-pagination/1 but I'm stumbling where it actually breaks the page up into the prescribed number of page. Right now I have script set for 5 results per page and while I can get the total number of records in the search result set, I can't get the results to span over say 3 pages if there's 15 results. Code:
Creating Temporary Table From Full-text Query
i'm using a full-text search on my db which works fine, but now i'm working on filtering the results further, like products in range of prices. my logic is to simply SELECT them out of the temporary table, only if it would be created. i don't think i need to paste any code since i think you get the idea.
Full Text File Search With Indexing Service On Windows
Here's a short tutorial on how to the OLE-DB extension to access Windows Indexing Service. Impress your office-mates with a powerful full-text search feature on your intranet. It's easier than you think. First, download and install the extension (http://sourceforge.net/project/show...kage_id=198554). Simply unzip the file and copy the correct version of php_oledb.dll into the PHP extensions folder. Then add the line extension=php_oledb.dll in php.ini and restart your web server. Now, if Indexing Service isn't running on your computer, turn it on. Go to Control Panel Administrative Tools Services and configure Indexing Service to start automatically. You can also ask the little dog in the search window to do it for you if you're using Windows XP. You will need to wait a while for Windows to build the initial index. It could take a couple hours. Once the extension is installed and the index is ready, you can start coding. To connect to Indexing Service, you use the oledb_open function: $link = oledb_open("Provider=MSIDXS"); You then call oledb_query with a SQL statement. Let us start with something simple: We'll look for all files on the computer containing the word "love": .....
Quickly Adding Text To A Mysql Text Field That Is NOT Empty
Is there a way to insert text into a mysql text field that already has text into it; without having first to extract the existing data and append the new text to that string variable and then insert the new string. Basically i'm looking for a way to do it with a single query not 2 (one being a select to gather existing data).
Give User A Choice Of Fields To Search With Full Text/Boolean?
I want to give the user the option of searching a combination of the fields $Topic, $Subtopic, $Theswords in Boolean/Full Text. The problem is if I make any of the fields empty prior to the query, I get a MySql syntax error message. The user has the option of selecting fields via checkboxes, but when the field is not selected the user will get the error message because the variable is empty in the query statemtnt. Are there any code suggestions for avoiding the error message when a field is not selected by the user to be searched? Code:
Access An Array From A Text File?
Im trying to build an array from elements I have stored in a text file (So I can access them on multiple pages). What is the syntax for this? I thought it might be... storedArray1 = array(require_once("/arrays/stored_array_1.txt")); or storedArray1 = array(include("/arrays/stored_array_1.txt")); but I guess you can only use the 'include' statement when inserting text into html code NOT php code?
Text Area Not Accepting Large Amounts Of Text
I have a form where teachers enter homework assignments and they are then stored in a MYSQL database and retrieved elsewhere. I have been using "get" with the form. The code is simple: <textarea name="array[assignment]" cols="60" rows="10" id="array[assignment]"></textarea> It does allow post of 100 words, etc. Stuff that teachers normally submit. What's happening is that it won't allow very large posts (over 300 words maybe? ) Not sure what the cut off is. When you press submit it won't go, or there is an error where it won't submit. Is there a limit for text fields? Since the fields scroll, I didn't think that having only 60 rows was any type of real limit, I though you could put in as much as needed. But then all of it ends up in the address bar, so there must be a limit of some sort.
Read And Display Japanese Text From Text File
I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with the same problem. The plan was to make a script to read and display japanese text. I will use it for making a japanese proverb script and for a japanese language study script. Method : I wrote a simple kanji text file (saved with UTF-8 encoding) I wrote a simple PHP script to display the file contents (saved with UTF-8 encoding) I specified the content-type header for the HTML page : <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> *** All files have the same encoding. *** UTF-8 supports japanese characters. and it works! this is my PHP (and HTML) script : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>PHP : Japanese Text File Read : Exercise 1</title> </head> <body> <?php $filename="japanese.txt"; //open file $fp = fopen($filename,'r'); //loop through each line in the file while($line=fgets($fp)) { //output current text file line print $line."<br>"; } //close file handle fclose($fp); ?> </body> </html> I know it's a very simple script, for testing purposes only. It displays the contents of the japanese text file line by line. The key was to save all files in the same encoding (I used UTF-8) and to specify the encoding / charset in the HTML header (<meta http-equiv="Content-Type" content="text/html; charset=utf-8">)
DB Access Objects VS Full Code
I was wondering if there is any difference in performance between using DB access objects and standard DB access code. Reason I'm asking is I believe each object takes a piece of memory and if I have a site that gets huge traffic and is heavily populated with DB info wont it burn through the server memory rather fast? For example I use this type of structure in a lot of my programs to perform queries on the DB’s. PHP Code:
Append Text At End Of Existing Text On Same Line
I'm working on a part of my web site that uploads images, then writes the name of the image to a text file. The upload part works fine. The part that writes the name of the image to the text file works fine. What I'm trying to do is, after all the files have been uploaded and all of the image names have been written to the WriteTo.txt file, append a written description of the picture at the end of the picture name. In other words, after a user uploads their pictures to the server I want to direct them to a page where they can label each of the pictures using a form. PHP Code:
Adding Text To Text Window With A Button
I have made an admin section of a site, What i want to do i have buttons under that have "BOLD" "center" and when clicked it adds <b></b> tags to the text area etc etc.. if the text area was called "message" how would i going about coding the images / buttons to add the code?
PHP - Using Mail() And Unicode Text - Text Gets Disturbed
I have the following problem. On a website there's a (simple) feedback form. This is used also by Polish visitors who (of course) type Polish text using special characters. However, when I receive the text in my mailbox, all special characters have been turned into mess...... For example: "wspólprace" is turned into "współprace". It seems PHP is handling the Unicode-8 strings quite well (when I 'echo' the strings on the site, I see the text correctly), until the point that it is send by using mail(). Is this a server configuration issue? Or something else? How can I get my text to remain in Unicode? I have this problem both on my testserver (Apache 1.3.28, PHP 4.3.2 on Windows XP) as on my providers server (Apache under Linux).
Remove Text Header In Text File
I have been having trouble removeing two header lines at the top of my txt file. You will see in my code the different things I have tried but with no luck. Below I posted my script and data. I am doing a few other things in my script as you will notice but this is the only thing I am having troble with. Code:
Parsing Text - Capture Text Between Two Tags
I want to have text in files, such as {body} {/body} and then be able to open that file and grab all of the data inbetween those tags. I could open the file and go through it until I see the {body} tag and then store data until I reach {/body} but that is a bad way to do it.
Text Returned From DB Gets Cutoff When Placed In A Text Field
I have a string that contains an apostrophe or a quotation mark, stored in a DB. I can retrieve the data, and display it properly (for editing) in a textarea, but when I try to put the string in a text field, it get's cut off right before the questionable character. For example: $string_in_database = "John's car." -displays correctly here <textarea><?php print $string_in_database ?></textarea> and displays this - John's car. -gets cutoff here <input type='text' value=''<?php print $string_in_database ?>' /> and displays this - John I've tried adding slashes and stripping slashes and I just can't figure out what I need to do.
Keep Text In Text Boxes After Form Is Rewritten
I'm trying to make a form that does the following: (1) the user answers a question by typing in a text box (2) a response is then written below the form, saying whether the answer is right or wrong and, perhaps making a comment of some kind (3) the user's answer remains visible in the original text box I've managed to write some code that does the first two things, but despite many attempts and much searching for code examples, I've failed to find a way of getting the answer to reappear in the text box when the page is rewritten. This is my code:
Replacing Text For Use In A Text Area...
I have a PHP page that allows a user to preview an email and then send it if(s)he is happy with it. Otherwise, they can click on an edit button and edit the text of the message. The text is then shown in a textarea element. While in situation A (the preview), a bit of formatting is useful (e.g <BR>), all of this formatting is a nuisance in the textarea. Basically, I would like to do the following: a. replace <BR> with a line break for the textarea b. get rid of double spaces and tabs before the text is loaded in the textarea c. put the <BR>s back in when the user is finished with editing the message. Is there a way to do this?
PHP/MySQL Text And SEO
I'm creating a news script to store news articles in a MySQL database and using PHP to access this DB. I was wondering since PHP processes before the page is loaded will it display the text from the DB and allow this text to be picked up by search engines?
Combo Box / Text Box Php Mysql
this is the the code, now here is the final result.... I get one combo box <?php require_once('..library_databaseConnectionsonli nequote.php'); ?> <? function select_cases_price () { $qy = "SELECT SellingPrice, Description FROM cases"; $rs = mysql_query ($qy) or die (mysql_error ()); while (mysql_fetch_array ($rs)) { $select .= "<option value='{$r[0]}'>{$r[0]}</option>"; $prices[] = $r{1}; } return array ($select, $prices); } ?> On your web page, call the function. <? list ($select, $prices) = select_cases_price (); ?> And a bit of JS: <script> function showPrice() { array prices (<? echo $prices ?>); var i = document.form.item.selectedIndex; document.form.SellingPrice = prices[i]; </script> <select name="Description" onUpdate="showPrice()"> <? echo $select; ?> </select> <input type="text" name="SellingPrice" value="">
Saving Text To MySQL
I have a small form where users can comment on some articles on the web site. But to prevent abuse I want the form to save the comments and email it to me to review. But that means that the user can still abuse the form itself or cause Query/SQL problems, (with special character for example). So how would I save ANY text to the database? And if I have to convert the text how do I retrieve it correctly? For example if the user enters "This is a quote, 'hello world'" how should I handle special characters? Would you advise me to handle all my text fields the same way to prevent abuse/hacking? And how should I protect my fields against hacking?
Displaying Text From MySQL
I am working on a very simple news page for a website. I've setup a simple form that writes news to my database and the data is then displayed on my news page. I have gotten everything to work successfully but the content in the article loses all its paragraph formatting when I try to display it. I can use break tags to make the formatting show up but there has to be an easier way. This is the code I am using now, which I found on a tutorial somewhere and then tried to modify to work for my site: Code:
How To Delete Only Certain Text In A Mysql Row?
I have a table setup that has a column setup as friends and users can add friends to this column no problem. What I would like to know is how to delete only certain parts of the text of the row/cell where their friends are stored. The friends text is seperated by the following : " , " That is a space on either side and comma in the middle of the space. I know how to explode the results and put into an array to display the reuslts, but is there a way to delete only one of the friends if the text is as follows. , thomas , frank , irene , I think you can get the idea. Is it possible to do this or should I just update the whole cell without the array[$i] result being the friend?
Mysql Data To A Text Box
I am trying to retrieve a text block from a Mysql database and display it inside of a <textarea> how do i do this?
Mysql Text Field
I have a DB with a column that is set as Text format. The data stored in the field will be stored in many lines. When I get the data from the DB I want it to display where the line breaks are I'm not sure how to write the script to do this. I have worked withe explode before but there is nothing come at the end of each line to do this with.
Rich Text With Php And Mysql
Could anyone recommend a good way to intergrate rich text (blog, forum like text, like this!) into a php/mysql web app I am building? Does a TEXT field handle the formatting (bold, font size, colours)? and what about storing links? Or must it be pharsed in and out each time you edit?
Text To MySQL Problem Need Ideas
I know how to upload text files and such my problem is that I may have many many text files so any editing of the files is out of the question. The files are not delimited, well so far I use and it works but with help of some editing.
Export Mysql To Text File Via PHP
I need help on how to export one of table mysql to text file to download. (not saving text into server) something with like header("Content-type: text/plain");
PHP - MySQL - Text Files - Speed
I've got a question that I'm sure is answered somewhere but I haven't run across it yet. I've got a site with a lot of content that's being pulled from a database. Most of the content changes on a very regular basis.. I take it, push it into some templates, and render it to the screen.. pretty standard stuff.. But some of the pages have large blocks of static content. Just as an example, lets take about 50 lines of formatted static HTML. This content doesn't change very often at all. The site is already designed to push through a template, so putting the content into static HTML pages isn't an option. The question is, should I store that content in MySQL or in a text file? I figured that MySQL would be easier on the system. The fetches seem like they would be pretty easy for MySQL to handle, no complex queries. I figured that pulling from a text file would require apache/php to open the file, read the file and then close the file every time someone hit that page. Am I putting unwarrented stress on our database?
Show Text From Mysql By Paragraph
I am trying to develop a site for news paper. i keep articles in a longtext field in Mysql. But when a retrieve the data from database. i lose all paragraphs. the total article in shown in one paragraph. But i want them be as it is the way i paste them. Pls help to do find out the solutions.
Displaying Text Pulled From A MySQL DB
I have a web edit, delete and update script set up. its all working pretty much as i need except for one thing, the editing function. When an admin clicks edit beside an entry that page is resubmitted using $PHP_SELF and a variable is set. A check is then carried out in each form field to see if this variable is set, if it is set then a query is carried out and it enters the value of the query result for a table field as the value for the form field. You can see this in the code below. My problem is this: when the values of the DB are echoes out into the form fields they dont display correctly or they just display the first word until they reach the first space and then nothing else. PHP Code:
Php/mysql Storing Formatted Text
I'm trying to make a message board. Everything seems to be working finally. The only problem is that when posting a reply to any thread. if the person types: this is my name It gets displayed as: this is my name , Where as it should display: this is my name on 4 different lines.. anybody know how i can do this?
Text Field As Date (MySQL)
I have a generic table used for many different generic functions. the fields are mainly varchar's but one of these varchars contains dates (in the format dd/mm/yyyy) for one reason or another. My question is, can I perform a query on this table, using date functions on this varchar field? I.e. search for the latest date?
Importing Text File Into MySQL DB
I'm writing a script to import a text file with fields delimited by ~ into a MySQL DB. I'm trying to import everything into an array first, so that one array row = one record row. Here is some dummy data, with the 񟐚' record having a couple of new lines where a new paragraph is. Note the other records have NULL in the same field: PHP Code:
Inserting Formatted Text Into Mysql ?
is there a way to format the text from a multi-line textfield (html), including line breaks, tabs etc. and to properly insert it into a mysql-table ?
Submitting Text For Use In A Mysql Database
This question has been bugging me for month. I have a website where people can enter stuff into a mysql database. Some of this information will already be shown in some textareas and input boxes, the user may change it and then hit submit. All the values are then passed to a mysql database, overriding the existing values (after the old ones have been backed-up). All of this works marvellous, apart from characters like &, ' and ". To make it even worse, some of the original text already contains &039; and other numeric character codes. Any values from the database are displayed by retrieving them from the DB [simplified of course] mysql_quer(...) $row = ... $Vold1 = $row[x]; $Vold2 = $row[y]; etc... <INPUT VALUE=$Vold NAME="x"> <TEXTAREA>$Vold</TEXTAREA NAME="y"> Any values that are submitted are processed as follows: $V1 = trim(stripslashes(htmlentities(trim($_POST["x"]))))) $V1 = trim(stripslashes(htmlentities(trim($_POST["y"]))))) then $V is inserted into the table using a mysql query.
Text To Date And Insert To Mysql...
Kindly break out the 4x2 and bring me to my senses. I seem to have gotten myself totally confused with php.net, mysql.org pages on dates etc, as well as groups.google. Could someone explain, even using pseudo code, how to take a text input I have set up as YYYY-MM-DD using php, and convert to a value mysql will insert into a Date (not timestamp, not datetime) field.
Mysql Output Text Formatting
I have stored data into mySQL through a multiple lines textarea input. When I try to print it out using the echo() function it doesn't print multiple lines, so everything is on one line. How can I fix this?
How To Treat TEXT From Mysql As A PHP Code
I need a page that can generate it's content completely dynamically, so in database i have objects like image, text, gallery and one special "custom" object - this should be any code in PHP that i want to execute during page generation. Code:
Retaining Paragraphs Of Text To MYSQL
Is there a quick and easy way to get paragraphs of text from a webform multiline text box into MYSQL without losing all of the returns (ie 3 Paragraphs remains and can be echo'd as 3 paragraphs and doesn't become one big one).
Limiting The Amount Of Text From A MySQL Call
I have the following code that pulls some information from a database and presents it (obviously), it also has a link to find out more about the presented information. One of the feilds is called a biography, I want to limit the amount of the field "biography" that is displayed, like the first 200 characters (maybe even ending in a ...) and have the rest of the biography dislay when the person clicks on the corresponding link. Is this possible? Code:
|