tollwerk / TYPO3-ext-tw_lucenesearch

Simple and lightweight implementation of the Apache Lucene Index as frontend search solution for TYPO3. Created by Joschi Kuphal (@jkphl), licensed under the terms of the GPL v2 license.
http://typo3.org/extensions/repository/view/tw_lucenesearch/
GNU General Public License v2.0
4 stars 3 forks source link

No reference values stored #2

Closed IndyIndyIndy closed 10 years ago

IndyIndyIndy commented 10 years ago

TYPO3 6.1.7 tw_lucenesearch 1.0.0

Because no links were put in the results, I looked at the model and found that the field-value "reference" contains only an empty array "'a:0:{}". I will try to look a bit into the Indexer why there are no reference values stored.

IndyIndyIndy commented 10 years ago

Ok, the problem begins with the following line:

$referenceVariable = $this->_getReferenceVariable(\TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($_GET, $_POST), $key, $config);

The first parameter is required to be an array of all $_GET and $_POST values. But when using realurl, those would be normally empty and would not contain the pages id-value. Shouldn't these values be read from the $GLOBALS array?

jkphl commented 10 years ago

Hi @IndyIndyIndy,

thanks for your feedback. Yes, you may be right. To be honest, I never really checked it w/ RealURL, as we were only using cooluri for some years now (I am, however, about returning to RealURL at the moment ...). I considered it always to be a problem that RealURL (in contrast to cooluri) doesn't write back the $_GET variables after decoding an URL, as extensions may rely on it.

I'd be happy if you could provide some more in depth inspiration (= pull request) how to get this working for RealURL as well.

Also, I'm planning to work on the extension in the very near future (= next 2-3 weeks), and there'll probably come a proper backend module, support for custom index entries and so on. So if you don't come up with a suggestion until then, I might look into this problem as well ...

Thanks again, cheers, Joschi

IndyIndyIndy commented 10 years ago

Ok.

All I did now was a dirty hack to get merge the $GLOBALS['TSFE']->id value with the rest of the array:

$array = array('id' => $GLOBALS['TSFE']->id);  
$array = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($array, $_POST);
$array = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($array, $_GET);

$referenceVariable      = $this->_getReferenceVariable($array, $key, $config);

But I didn't look much at the rest of the code until now,

jkphl commented 10 years ago

Yeah, this is something I did also recently (in another RealURL based project, independently of the Lucene search extension), as RealURL doesn't do this automatically. You may get along with this as long as you don't use any other $_GET variable than id. I believe, however, that we still need a proper — speak: universal — patch for this.

jkphl commented 10 years ago

Should be fixed with commit 826f845f2a53f117d1639bf4b9c0900b1e600b1e.