Avatar

Search Phrase Drops to 3 Words When Clicking Second Page (Bugs)

by Magma, Tuesday, September 10, 2019, 16:17 (1661 days ago)

If I do a search with 4 words or more, when clicking on page two of the search results the search phrase in the search box drops to 3 words all the time.

For example "red car in water" when clicking page 2 changes to "red car in"

On MLF search for "Release of version 2.4" when you click on page 2 of the search results the search phrase in the search box changes to "Release of version".

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Wednesday, September 11, 2019, 06:52 (1661 days ago) @ Magma

Hello

If I do a search with 4 words or more, when clicking on page two of the search results the search phrase in the search box drops to 3 words all the time.

For example "red car in water" when clicking page 2 changes to "red car in"

On MLF search for "Release of version 2.4" when you click on page 2 of the search results the search phrase in the search box changes to "Release of version".

I can confirm that. It seems to affect not only the search input field itself because I get 173 results (currently) with the search term "Release of version 2.4" and one can see that the results on the later pages do not match the "2.4" part but only the search for "Release of version".

So the thing is that the search is obviously limited to three words but one can input more than the three allowed words. I expect this limitation to be introduced because of performance issues with the resulting database query.

Because of possible DoS attacks IMHO we can not completely remove the search-word-limit and a higher limit will lead to a situation when someone could ask, why the limit is at six, eight or twelve words.

We should discuss if there is a need for a limit (IMHO there is) and if so, where to set it.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Magma, Wednesday, September 11, 2019, 09:22 (1661 days ago) @ Auge

So the thing is that the search is obviously limited to three words but one can input more than the three allowed words.

Ok, I've never seen that before on other websites. Is it just a matter of changing these numbers then?

// limit to 3 words:
if (count($search_array) > 3) {
for ($i = 0; $i < 3; ++$i) {

thanks

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Wednesday, September 11, 2019, 11:10 (1660 days ago) @ Magma

Hello

So the thing is that the search is obviously limited to three words but one can input more than the three allowed words.


Ok, I've never seen that before on other websites.

I don't know, why Alex introduced this limit and I see several cases, when I would like to be able to input a longer sequence. Take the statement from my last posting as an assumption.

Is it just a matter of changing these numbers then?

// limit to 3 words:
if (count($search_array) > 3) {
for ($i = 0; $i < 3; ++$i) {

Yes, that's in general all.

    // limit to 3 words:
    if (count($search_array) > 3) {
        for ($i = 0; $i < 3; ++$i) {
            $stripped_search_array[] = $search_array[$i];
        }
        $search_array = $stripped_search_array;
    }

If we decide to raise the limit only the numbers have to change. In my example I replaced the hardcoded number with a variable.

    // limit to X ($limit) words:
    $limit = 9; // Fictional variable with the new limit for the amount of words.
    if (count($search_array) > $limit) {
        for ($i = 0; $i < $limit; ++$i) {
            $stripped_search_array[] = $search_array[$i];
        }
        $search_array = $stripped_search_array;
    }

Additionally I would replace the for loop with a foreach loop. That way there would be only a single point to set and use the limiting number.

    // limit to X ($limit) words:
    $limit = 9; // Fictional variable with the new limit for the amount of words.
    if (count($search_array) > $limit) {
        foreach ($search_array as $search_item) {
            $stripped_search_array[] = $search_item;
        }
        $search_array = $stripped_search_array;
    }

If we would decide to abolish the limit on the other hand, we could remove the whole block.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Micha ⌂, Wednesday, September 11, 2019, 13:28 (1660 days ago) @ Auge

Hi,

Additionally I would replace the for loop with a foreach loop. That way there would be only a single point to set and use the limiting number.

    // limit to X ($limit) words:
$limit = 9; // Fictional variable with the new limit for the amount of words.
if (count($search_array) > $limit) {
foreach ($search_array as $search_item) {
$stripped_search_array[] = $search_item;
}
$search_array = $stripped_search_array;
}

If we would decide to abolish the limit on the other hand, we could remove the whole block.

What is your intention of the foreach-loop? The foreach-loop is a loop over all elements in then array. So, you first check the limit (e.g. 9 elements), and than you create a deep copy of the array containing all elements?!

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Thursday, September 12, 2019, 06:24 (1660 days ago) @ Micha

Hello

    // limit to X ($limit) words:
    $limit = 9; // Fictional variable with the new limit for the amount of words.
    if (count($search_array) > $limit) {
        foreach ($search_array as $search_item) {
            $stripped_search_array[] = $search_item;
        }
        $search_array = $stripped_search_array;
    }

What is your intention of the foreach-loop? The foreach-loop is a loop over all elements in then array. So, you first check the limit (e.g. 9 elements), and than you create a deep copy of the array containing all elements?!

Ahh, yes. It's only to muddle all the people.

Let's start again. If we cut every input to a length of X words (stored in $limit), we can simply use the function array_splice.

    // limit to X ($limit) words:
    $limit = 9; // Fictional variable with the new limit for the amount of words.
    array_splice($search_array, $limit);
    foreach ($search_array as $search_item) {
        $stripped_search_array[] = $search_item;
    }
    $search_array = $stripped_search_array;
 

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Micha ⌂, Thursday, September 12, 2019, 08:08 (1660 days ago) @ Auge

Hi,

Ahh, yes. It's only to muddle all the people.

Check ;-)


Let's start again. If we cut every input to a length of X words (stored in $limit), we can simply use the function array_splice.

    // limit to X ($limit) words:
$limit = 9; // Fictional variable with the new limit for the amount of words.
array_splice($search_array, $limit);
foreach ($search_array as $search_item) {
$stripped_search_array[] = $search_item;
}
$search_array = $stripped_search_array;

This is the next try to muddle all the people? Please remove the loop and all will be fine. ;-)

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Thursday, September 12, 2019, 08:48 (1660 days ago) @ Micha

Hello

Let's start again. If we cut every input to a length of X words (stored in $limit), we can simply use the function array_splice.

    // limit to X ($limit) words:
$limit = 9; // Fictional variable with the new limit for the amount of words.
array_splice($search_array, $limit);
foreach ($search_array as $search_item) {
$stripped_search_array[] = $search_item;
}
$search_array = $stripped_search_array;


This is the next try to muddle all the people? Please remove the loop and all will be fine. ;-)

Yes, it is. :-/

Sleeping only five hours after a concert is not enough.

[image]

Sleaford Mods yesterday in Berlin.

    // limit to X ($limit) words:
    $limit = 9; // Fictional variable with the new limit for the amount of words.
    array_splice($search_array, $limit);
 

And now?

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Micha ⌂, Thursday, September 12, 2019, 09:00 (1660 days ago) @ Auge

Hi,

Sleaford Mods yesterday in Berlin.

Not my favorite ;-)

    // limit to X ($limit) words:
$limit = 9; // Fictional variable with the new limit for the amount of words.
array_splice($search_array, $limit);
 

And now?

You are the very best. :-D If we do not remove the limit, I recommend this code part.

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Thursday, September 12, 2019, 09:32 (1660 days ago) @ Micha

Hello

Sleaford Mods yesterday in Berlin.


Not my favorite ;-)

Yes, it's not for everyone. :-)

    // limit to X ($limit) words:
$limit = 9; // Fictional variable with the new limit for the amount of words.
array_splice($search_array, $limit);
 

And now?


You are the very best. :-D If we do not remove the limit, I recommend this code part.

Ok, there's only one question left. Where to set the limit?

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Micha ⌂, Thursday, September 12, 2019, 09:58 (1659 days ago) @ Auge

Hi,

Sleaford Mods yesterday in Berlin.


Not my favorite ;-)


Yes, it's not for everyone. :-)

Nur die Harten komm' in' Garten. ;-)

Ok, there's only one question left. Where to set the limit?

I suggest to add a further variable. The admin should be able to mange the number of words (and the performance of the system).

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Thursday, September 12, 2019, 10:41 (1659 days ago) @ Micha

Hello

Sleaford Mods yesterday in Berlin.


Not my favorite ;-)


Yes, it's not for everyone. :-)


Nur die Harten komm' in' Garten. ;-)

Yep! :-)

Ok, there's only one question left. Where to set the limit?


I suggest to add a further variable. The admin should be able to mange the number of words (and the performance of the system).

Ok, a further setting. Default value 7?

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Micha ⌂, Thursday, September 12, 2019, 10:56 (1659 days ago) @ Auge

Hi,

Ok, a further setting. Default value 7?

Seems to be an adequate value, yes.

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Micha ⌂, Thursday, September 12, 2019, 10:59 (1659 days ago) @ Auge

... and we also should reduce the number of words at the first result page to avoid confusion.

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Search Phrase Drops to 3 Words When Clicking Second Page

by Auge ⌂, Thursday, September 12, 2019, 11:01 (1659 days ago) @ Micha

... and we also should reduce the number of words at the first result page to avoid confusion.

Yep.

--
Trenne niemals Müll, denn er hat nur eine Silbe!

RSS Feed of thread