Search result issue

Post Reply
xdokice
Posts: 25
Joined: Tue Aug 24, 2010 8:56 am

Search result issue

Post by xdokice »

Hello !

I have installed Sphinx search, but I'm facing an issue where searching returns zero results. It only shows the thumbnails that were previously approved in the 'search log.'
For example, when I type: domain.com/?search=mom, I get no results, even though my database contains many galleries with "mom" in the title.
Any idea what could be causing this issue?

Thanks.
admin
Site Admin
Posts: 37649
Joined: Wed Sep 10, 2008 11:43 am

Re: Search result issue

Post by admin »

Hello!

Did you try to perform the same search in sphinx?
does it return results? the point is that the script returns what it gets from Sphinx, if it returns nothing - the same returns the script
Don't forget to run script update
xdokice
Posts: 25
Joined: Tue Aug 24, 2010 8:56 am

Re: Search result issue

Post by xdokice »

I don't know how to perform a search in Sphinx. If you mean that new files are created daily in the /sphinx/ folder, then yes, they are. But I don't know how to check otherwise if Sphinx is working or not.
admin
Site Admin
Posts: 37649
Joined: Wed Sep 10, 2008 11:43 am

Re: Search result issue

Post by admin »

here's an example in ssh

search -i my_index "keyword"
Don't forget to run script update
xdokice
Posts: 25
Joined: Tue Aug 24, 2010 8:56 am

Re: Search result issue

Post by xdokice »

I tried it: but got "-bash: search: command not found"
I tried to type on public_html than on /scj/sphinx/ folder but same ?
Where exactly need to go on sssh to type this command ?
Thanks.
admin
Site Admin
Posts: 37649
Joined: Wed Sep 10, 2008 11:43 am

Re: Search result issue

Post by admin »

Ok, let chatgpt help you)

# Guide to Searching in Sphinx from the Command Line

## 3. Running Search Queries Using SphinxQL
SphinxQL is a SQL-like query language for searching within Sphinx indexes.

### Connecting to SphinxQL
To interact with Sphinx via MySQL-like queries, connect to it using:

```sh
mysql -h 127.0.0.1 -P 9306
```

### Basic Search Query
Execute a simple search query using `MATCH`:

```sql
SELECT * FROM my_index WHERE MATCH('your_query');
```

Example:

```sql
SELECT * FROM my_index WHERE MATCH('sphinx');
```

### Filtering Results
To filter results based on attributes:

```sql
SELECT * FROM my_index WHERE MATCH('laptop') AND price = 100;
```

### Sorting Results
Sort results by an attribute:

```sql
SELECT * FROM my_index WHERE MATCH('laptop') ORDER BY price ASC;
```

Sort in descending order:

```sql
SELECT * FROM my_index WHERE MATCH('laptop') ORDER BY price DESC;
```

### Limiting and Offsetting Results
To limit the number of results:

```sql
SELECT * FROM my_index WHERE MATCH('laptop') LIMIT 10;
```

To paginate results:

```sql
SELECT * FROM my_index WHERE MATCH('laptop') LIMIT 10 OFFSET 10;
```

### Boolean Search Operators
Use boolean operators for advanced searching:

```sql
SELECT * FROM my_index WHERE MATCH('apple | banana'); -- Matches either apple or banana
SELECT * FROM my_index WHERE MATCH('apple & banana'); -- Matches both apple and banana
SELECT * FROM my_index WHERE MATCH('apple -banana'); -- Matches apple but not banana
```
Don't forget to run script update
xdokice
Posts: 25
Joined: Tue Aug 24, 2010 8:56 am

Re: Search result issue

Post by xdokice »

when I type example:
SELECT * FROM main_site_index WHERE MATCH('granny');
I have result like this:

MySQL [(none)]> SELECT * FROM main_site_index WHERE MATCH('granny');
+--------+------------+----------+------------+-----------+--------------+--------------+------------------------------------------------------------+------------+
| id | date | duration | sponsor_id | total_ctr | total_shows | content_type | tag_ids | categories |
+--------+------------+----------+------------+-----------+--------------+--------------+------------------------------------------------------------+------------+
| 3055 | 1707557464 | 720 | 1 | 0.000000 | 629.000000 | 4 | 21,482,527,528 | 1 |
| 105132 | 1707824006 | 212 | 1 | 0.003592 | 2321.000000 | 4 | 7,31,276,333,482,498,608,3040,5683 | 1 |
| 105310 | 1707824009 | 340 | 1 | 0.000000 | 398.000000 | 4 | 7,108,147,177,248,266,411,480,482,1563,2403 | 1 |
| 105334 | 1707824010 | 611 | 1 | 0.002837 | 10011.000000 | 4 | 4,7,56,128,244,266,320,411,436,482,801,1437,1688,1762,2163 | 1 |
| 105335 | 1707824010 | 1634 | 1 | 0.003588 | 503.000000 | 4 | 413,482,554,674,1365,3097,3098 | 1 |
| 105337 | 1707824010 | 924 | 1 | 0.000000 | 146.000000 | 4 | 40,150,151,482,6809,7229 | 1 |
| 105415 | 1707824011 | 1826 | 1 | 0.000852 | 2262.000000 | 4 | 7,56,334,482,544,2364,2411,3365,7274,7275 | 1 |
| 105480 | 1707824012 | 1235 | 1 | 0.003042 | 10014.000000 | 4 | 7,80,147,230,238,395,482,557,565,901,1020,1021,1299 | 1 |
| 105506 | 1707824012 | 365 | 1 | 0.003581 | 487.000000 | 4 | 7,76,131,155,181,200,482,557,857,3496 | 1 |
| 132345 | 1707898682 | 328 | 1 | 0.000000 | 151.000000 | 4 | 248,482,490,797,6424,6444 | 1 |
| 132388 | 1707898682 | 1028 | 1 | 0.003582 | 10037.000000 | 4 | 7,147,482,523,531,830,943,1539,2048 | 1 |
| 132450 | 1707898684 | 135 | 1 | 0.003584 | 884.000000 | 4 | 108,274,482,6894 | 1 |
| 132545 | 1707898685 | 524 | 1 | 0.000000 | 153.000000 | 4 | 57,126,402,482,2415,5112,7681 | 1 |
| 132577 | 1707898686 | 375 | 1 | 0.000000 | 314.000000 | 4 | 7,76,82,181,482,536,857,864 | 1 |
| 154369 | 1707900987 | 365 | 1 | 0.003591 | 1706.000000 | 4 | 7,71,147,420,482,490,3938,5597,5837,7975 | 1 |
| 154449 | 1707900988 | 469 | 1 | 0.003583 | 10024.000000 | 4 | 7,8,482,599,943,1472,1579,1872,2159 | 1 |
| 154475 | 1707900989 | 420 | 1 | 0.002719 | 862.000000 | 4 | 25,107,482,521,792,843,1067,2455,3360 | 1 |
| 154476 | 1707900989 | 375 | 1 | 0.001705 | 3638.000000 | 4 | 7,31,63,244,320,482,665,783,1775,2379,3465,3466,5842 | 1 |
| 154483 | 1707900989 | 483 | 1 | 0.003591 | 2853.000000 | 4 | 7,33,56,482,1238,1239,1913,2370,8343 | 1 |
| 154488 | 1707900989 | 1044 | 1 | 0.003592 | 2551.000000 | 4 | 7,31,209,276,482,737,1172,2774,4528 | 1 |
+--------+------------+----------+------------+-----------+--------------+--------------+------------------------------------------------------------+------------+

-----------------------------------------------------------------


MySQL [(none)]> SHOW TABLES;
+--------------------------------+-------+
| Index | Type |
+--------------------------------+-------+
| main_site_delta_index | local |
| main_site_index | local |
| main_site_search_queries_index | local |
+--------------------------------+-------+
3 rows in set (0.000 sec)


--------------------------------------------------------------
But when I type for example:

MySQL [(none)]> SELECT * FROM my_index WHERE MATCH('mature') AND price = 100;
than got error message:

ERROR 1064 (42000): unknown local index 'my_index' in search request
admin
Site Admin
Posts: 37649
Joined: Wed Sep 10, 2008 11:43 am

Re: Search result issue

Post by admin »

I see, I hoped that it'd be clear that 'my_index' should be replaced with real names. but looks like this might be a be complicated ..

Ok, send admin are and ssh access, I'll check it
Don't forget to run script update
Post Reply