opened
pfeiferchristopher
username_0
I myself do not know what is needed to change in order for this to work within Laravel 5.0 but I would love to see it, I imagine it's a few method name changes or something not too much.
Laravel 5.0 update possible?
issue
created
thangngoc89
username_1
I'm working on a L5 branch 
You can install and try it (using composer vcs)
https://github.com/username_3/larasearch/pull/71
comment
created
pfeiferchristopher
username_0
@username_1 if you could explain the steps to do so I've be very thankful lol
comment
created
thangngoc89
username_1
@username_0 you can do something like this

```js
"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/username_1/larasearch"
        }
    ],
    "require": {
        "username_3/larasearch": "dev-develop"
    }
```
comment
created
pfeiferchristopher
username_0
@username_1 Thanks I'll give it a shot.
comment
created
thangngoc89
username_1
@username_0 OK. PRs welcome
comment
created
marijang
username_2
Is it L5 Possible?
comment
created
pfeiferchristopher
username_0
@username_2 I'm currently using the version shown above and it is working properly for pretty much everything. I haven't been able to get on-change indexing working properly I believe it may be because of the changes to the Queue system between L4 and L5 but I haven't had time to look into it and try to create a PR to fix it.
comment
created
marijang
username_2
Are you using lennynyktyk version?
comment
created
pfeiferchristopher
username_0
@username_2 no just googled it. I'm going to try it tonight.
comment
created
pfeiferchristopher
username_0
@username_2 how do I install that version of this package? I'm not good at version control.
comment
created
marijang
username_2
@username_3 must approve pull request
https://github.com/username_3/larasearch/pull/75

I will wait L5 version. This is great package. I need it for autocomplete for search users:D

Thanks @username_3
comment
created
pfeiferchristopher
username_0
@username_2 by specifying the location of @username_1 project I was able to install his pull requests before being approved. I can't do that with the lennynyktyk version?
comment
created
iverberk
username_3
I just updated a bunch of stuff to make this compatible with L5. Could people check the L5 branch and see if it works within Laravel 5 installations?
comment
created
pfeiferchristopher
username_0
I will in about 12 hours. I'll give it a thorough testing.
comment
created
pfeiferchristopher
username_0
@username_3 I'm so terrible at using git to install specific versions. What version should I set to install the changes you want?
comment
created
thangngoc89
username_1
@username_0 It should be dev-L5 branch in composer
comment
created
pfeiferchristopher
username_0
Yeah I'm mean `"username_3/larasearch": "dev-develop",` what should go where `"dev-develop"`
comment
created
iverberk
username_3
@username_0 you should add "username_3/larasearch": "dev-L5" to your composer dependencies.
comment
created
pfeiferchristopher
username_0
@username_3 okay I ran into the same issue I had previously manually fixed.
```ssh
[ErrorException]
  Undefined index: errors
```
during the first batch. Going through the code I found this in `\Iverberk\Larasearch\Index.php`
```php
if ($results['errors'])
```
and by changing it to
```php
if ( array_key_exists('errors', $results) )
```
comment
created
iverberk
username_3
I believe the bulk import should always return if there are errors or not? So how are you hitting this case? Which version of Elasticsearch are you using?
comment
created
pfeiferchristopher
username_0
@username_3 no I'm not saying the bulk isn't returning properly. It seems as though when there are no errors present in the `$results` when no errors occur. So by using `$results['errors']` an exception for `Undefined index: errors` is thrown. Where as with my fix it looks to see if the key `['errors']` exists within `$results` or not.

With my change shown above the entire package now works wonderfully. Artisan commands for `paths` and `reindex` with `--relations` as well as `--dir=app/Models` worked perfectly. Also, was able to text that the observer and queue jobs are queuing and firing as they should. Everything except the `$results['errors']` is working flawlessly.
comment
created
pfeiferchristopher
username_0
Here's my `->bulk()` method:
```php
public function bulk($records)
    {
        $params['index'] = $this->getName();
        $params['type'] = $this->getProxy()->getType();
        $params['body'] = $records;

        $results = self::getClient()->bulk($params);

        if ( array_key_exists('errors', $results) )
        {
            $errorItems = [];

            foreach ($results['items'] as $item)
            {
                if (array_key_exists('error', $item['index']))
                {
                    $errorItems[] = $item;
                }
            }

            throw new ImportException('Bulk import with errors', 1, $errorItems);
        }
    }
```
comment
closed
pfeiferchristopher
username_0
issue
created
pfeiferchristopher
username_0
@username_3 I'm sorry I forgot to post this. But I did in fact have an older version of ES installed on my local environment and that was causing the issue. I have been using purely `dev-L5` and it's been working great.
comment