Ошибка no index for fields

Echo_N1

1 / 1 / 1

Регистрация: 15.10.2013

Сообщений: 32

1

16.05.2014, 02:25. Показов 2091. Ответов 2

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

При попытке сортировки выдает ошибку «no index for fields»

Delphi
1
2
3
begin 
Table1.IndexFieldNames:='ФИО'; 
end;

Используемые элементы на моей форме: datasource1, table1, DbGrid1

как пофиксить?
Индекс ФИО существует в колонке.



0



5 / 5 / 1

Регистрация: 26.07.2012

Сообщений: 28

16.05.2014, 05:57

2

Видимо не существует, проверь точно ли этот индекс



1



1 / 1 / 1

Регистрация: 15.10.2013

Сообщений: 32

16.05.2014, 13:05

 [ТС]

3

Сделал.
Не определяло индекс с пробелами



0



 
frEE)stylEr
 
(2005-02-02 19:58)
[0]

у меня такая проблема. Есть база данных(PARADOX), создаю Ttable, добавляю в Indexdefs новую запись. Потом почему то если нажать на список индексных полей(IndexFieldNames) то запись индексное поле созданное мной удаляется автоматически. Если программно это делать, т.е
TblMaterial.IndexFieldNames := «Code»
то поялвляется ошибка
«No Index for fields «Code»»
в чём дело ?? как добавить индексное поле  в эту базу?


 
dBASE
 
(2005-02-02 22:24)
[1]

>>в чём дело ??

No Index for fields «Code»

>>как добавить индексное поле  в эту базу?

Таки индекс или поле ?


 
frEE)stylEr
 
(2005-02-03 08:58)
[2]

не добавляются индексы. Я добавляю в Indexdefs новую запись, но она автоматически удаляется если нажать на список IndexFieldNames. Если добавлять программно TblMaterial.IndexFieldNames := «name»;
то вылезает эта ошибка.
вот я и спрашиваю как добавить индекс?


 
Johnmen ©
 
(2005-02-03 09:19)
[3]

LocalSQL.hlp : CREATE INDEX …


 
frEE)stylEr
 
(2005-02-03 09:37)
[4]

а можно немного поподробней?
а то я прочитал но всё равно ничего не понял


 
Соловьев ©
 
(2005-02-03 10:38)
[5]


> а то я прочитал но всё равно ничего не понял

пример видел? запусти SQL Explorer и мучай dbdemos


 
frEE)stylEr
 
(2005-02-03 12:46)
[6]

я незнаю как SQL Explorer внести новый индекс в БД.
расскажите на пальцах пожалуйста. а то только начинаю работать с БД.


 
Соловьев ©
 
(2005-02-03 12:54)
[7]

жмемь на dbdemos даблклик, переходим к закладке с парава — EnterSQL
набираем(копируем) пример и жмемь желтую пимпочку. Смотрим результат. нажав в дереве на нужной таблице Indices


 
frEE)stylEr
 
(2005-02-03 13:57)
[8]

большое спасибо!!!
всё получилось!!!!


New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Open

pierreclr opened this issue

Apr 15, 2016

· 10 comments

Assignees

@superkhau

Comments

@pierreclr

Hi,

I discovered loopback few weeks ago and I find it amazing ! However I need your help to solve my problem on redis connector:
The ‘where’ filter does not work despite indexing the fields I want to query on .. indeed, when I’m trying to call model.find({where: {field: true}, limit: 10}, function …) it does not consider my query at all and give me an array of the ten first model insertions …

However, the same query in the loopback explorer is working well … even if i’m just a JavaScript beginner I think there’s something wrong in the nodeAPI redis adapter

Could someone light my mind about how using redis-adapter to avoid problem ? I know that this project is under development and I accept any thug solution ;)

Thank you to strongloop / loopback team and all contributors for this awesome product !

@alexbeer2048

I’m getting a similar error when using the destroyAll method.

Code snippet:

var ONE_HOUR = 1000 * 60 * 60;
var oneHourAgo = new Date(Date.now() - ONE_HOUR);
ServiceUpdateStats.destroyAll({
    or: [
        { lastRead: { lt: oneHourAgo } },
        { lastRead: null }
    ]
} , function (err, obj) {
    if (err) {
        console.log(err);
        return;
    }
    var destroyed = obj.count;
    if (destroyed) {
        console.log('ServiceUpdateStats: destroyed ' + destroyed + ' objects');
    }
});

This works fine with the mongodb connector (deletes entries with date field ‘lastRead’ set to date value older than an hour or empt).

When i chang the datasource for this model to loopback-connector-redis i get this error:

/path/to/project/node_modules/mongodb/lib/utils.js:98
process.nextTick(function() { throw err; });
^
Error: ServiceUpdateStats: no indexes found for or impossible to sort and filter using redis connector
at BridgeToRedis.all (/path/to/project/node_modules/loopback-connector-redis/lib/redis.js:504:19)
at BridgeToRedis.destroyAll (/path/to/project/node_modules/loopback-connector-redis/lib/redis.js:620:14)
at doDelete (/path/to/project/node_modules/loopback-datasource-juggler/lib/dao.js:1926:19)
at /path/to/project/node_modules/loopback-datasource-juggler/lib/dao.js:1900:11
at doNotify (/path/to/project/node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
at doNotify (/path/to/project/node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
at doNotify (/path/to/project/node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
at doNotify (/path/to/project/node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
at Function.ObserverMixin._notifyBaseObservers (/path/to/project/node_modules/loopback-datasource-juggler/lib/observer.js:121:5)
at Function.ObserverMixin.notifyObserversOf (/path/to/project/node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
npm ERR! Linux 4.4.0-0.bpo.1-amd64
npm ERR! argv «/usr/bin/nodejs» «/usr/bin/npm» «start»
npm ERR! node v4.4.3
npm ERR! npm v3.8.7
npm ERR! code ELIFECYCLE

I wonder if there are restrictions using filters with this connctor or is it a bug that can be fixed.

Edit:
Redis server v=3.0.7 running on debian

@pierreclr

Is your «lastRead» field indexed in your redis database ? (Or in your JSON model definition)
Built in loopback Redis ORM could not sort or more globally query on field which is not indexed …

@alexbeer2048

At my first attempt I didn’t set it indexed, but I also tried setting ALL the properties index parameters to true as well and it did not make a difference. Same error.

model JSON:

...
    "lastRead": {
      "type": "date",
      "required": true,
      "index": true
    },
...

Tbh, I don’t know if i can set the index parameter in the redis db directly (I know little about redis yet), or if it would make a difference to setting it in the loopback model files. I’m hoping the connector would do that form me.

@pierreclr

Since the error is coming from the redis database itself I imagine you can set index in the redis db directly. However, you can also define it by adding «id : true» in your model.json files for the fields you need to query on !

@alexbeer2048

I found out by reviewing the code that ‘and’ or ‘or’ operators are not supported in where queries yet.
Its right there in the error, but not so obvious:

… no indexes found for OR impossible to sort and filter …

The error is shown because there is no indexed field ‘or’ on my model. But of course I meant ‘or’ as an operator, not as a field.

I could sort my problem for most cases by simplifying the query bit and adding some extra code to process the result.

Did you mean «index: true»? I set it for all fields used in queries and it works.

I made an attempt to rewrite the code of the prototype.all() method (in lib/redis.js) to support those operators but it was not a bit of a hack and only worked properly for ‘and’ so i dropped it. But I will give it another try if I have some time to learn more about redis and some of the methods it provides.

@penguinpowernz

Once you get to setting up auth you will have problems, as the common code in the loopback repo does not explicitly set index: true on the ACL models etc, I guess other connectors implicitly determine the indexes?

@penguinpowernz

@superkhau

@bajtos

Let’s move the discussion about missing indexes in built-in Auth models to strongloop/loopback#3011 and keep this issue focused on how to configure the Redis connector and/or the models to support the kind of queries described in the issue description.

@WendySanarwanto

Hello All,

Any updates about this issue ?

INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Thanks. We have received your request and will respond promptly.

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It’s Free!

*Tek-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

No index for field error

No index for field error

(OP)

27 Jul 04 11:25

Can anyone help with this — if I had any hair left I would be pulling it out!

I have a table (FtNote.db) containing 3 fields
LANGUAGE A 2
FOOTNOTE A 3
FOOTDESC M 10

Language and Footnote make up the primary key.

However I keep getting an error «FtNote: No Index for fields FOOTNOTE» on the line I open the FtNote Table.

I have checked the Fields editor to ensure all 3 fields are present and listed correctly. I have also tried removing all 3 fields from the editor, but get the same error.

Can anyone suggest what might be causing the problem?

Thanks

Roger

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Join Tek-Tips® Today!

Join your peers on the Internet’s largest technical computer professional community.
It’s easy to join and it’s free.

Here’s Why Members Love Tek-Tips Forums:

  • Tek-Tips ForumsTalk To Other Members
  • Notification Of Responses To Questions
  • Favorite Forums One Click Access
  • Keyword Search Of All Posts, And More…

Register now while it’s still free!

Already a member? Close this window and log in.

Join Us             Close

    msm.ru

    Нравится ресурс?

    Помоги проекту!

    >
    Сортировка
    , Сортировка

    • Подписаться на тему
    • Сообщить другу
    • Скачать/распечатать тему

      


    Сообщ.
    #1

    ,
    13.06.05, 15:29

      1)dBASE tables
      2) BDE
      Здравствуйте у меня проблемка.
      При попытке сортировки элементов в DBGrid1 таким кодом

      if table1.IndexFieldNames=’NAZVA’ then table1.IndexFieldNames:=’NAZVA’
      else table1.IndexFieldNames:=’WID_TRANSP’;

      возникает ошибка
      Project Project1.exe raised exception class EDatabaseError with message ‘Table: No index for fields ‘WID_TRANSP’’. Process stopped. Use step or run to continue. :wall:

      Подскажете как можно отсортировать.


      SPrograMMer



      Сообщ.
      #2

      ,
      13.06.05, 17:02

        Цитата neznayka @ 13.06.05, 15:29

        возникает ошибка
        Project Project1.exe raised exception class EDatabaseError with message ‘Table: No index for fields ‘WID_TRANSP’’. Process stopped. Use step or run to continue

        нет индекса для поля WID_TRANSP

        Цитата neznayka @ 13.06.05, 15:29

        Подскажете как можно отсортировать

        или индекс создать, дла вышеуказанного поля, или запрос с Order By:

        ExpandedWrap disabled

          Select * From YorTable

          Order By  WID_TRANSP


        Anatoly Podgoretsky



        Сообщ.
        #3

        ,
        13.06.05, 17:16

          И вместо IndexFieldNames используй IndexName


          neznayka



          Сообщ.
          #4

          ,
          13.06.05, 18:06

            СЕТИМ РАЗОБРАЛСЯ СОРТИРУЮ ТАК

            ExpandedWrap disabled

              procedure sort1(TABLE1:TTable;listbox1:TListBox);

              var s:string;

                 List: TStrings;

                 i:integer;

              begin

              Table1.IndexDefs.Update;

              TABLE1.GetIndexNames(listbox1.Items);

              if listbox1.Items.Count>0 then  begin

              for i:=0 to listbox1.Items.Count do begin

                   if listbox1.Items.Strings[i]=’NEWINDEX2′ then begin

              Table1.AddIndex(‘NewIndex1’, ‘NAZVA’, [IxExpression]);

              Table1.IndexName:=’NewIndex1′;

              Table1.IndexDefs.Update;

              Table1.DeleteIndex(‘NewIndex2’);

              end

              else begin

                  Table1.AddIndex(‘NewIndex2’, ‘NAZVA’, [IxExpression]);

              Table1.IndexName:=’NewIndex2′;

              Table1.IndexDefs.Update;

              Table1.DeleteIndex(‘NewIndex1’);

                      end;

                      break;

                      end;

                      end

                      else  begin

              Table1.AddIndex(‘NewIndex2’, ‘NAZVA’, [IxExpression]);

              Table1.IndexDefs.Update;

              Table1.IndexName:=’NewIndex2′;

               Table1.IndexDefs.Update;

                            end;

              TABLE1.Refresh;

              end;

            Проблема другая всё харашо работала в друг начло писать

            Цитата

            Class EDBEngine error whith message ‘Table is busy’

            Сообщение отредактировано: Bas — 14.06.05, 05:38

            Wizard

            Bas



            Сообщ.
            #5

            ,
            14.06.05, 05:41

              1.Таблица открыта другим пользователем в режиме монопольного доступа
              2.BDE — не отпустило таблицу
              3.При создании индексов таблица должна быть открыта в монопольном режиме.


              Anatoly Podgoretsky



              Сообщ.
              #6

              ,
              14.06.05, 05:55

                Какие то странные манипуляции с индексами. Зачем?

                Wizard

                Bas



                Сообщ.
                #7

                ,
                14.06.05, 06:04

                  Цитата Anatoly Podgoretsky @ 14.06.05, 05:55

                  Какие то странные манипуляции с индексами. Зачем?

                  :yes:
                  Не проще на этапе проектирования добавить все индексы в IndexDefs , а нужный индекс активировать по клику на Title грида(кнопку,выбрать из списка,….)


                  neznayka



                  Сообщ.
                  #8

                  ,
                  14.06.05, 14:16

                    Цитата

                    Не проще на этапе проектирования добавить все индексы в IndexDefs , а нужный индекс активировать по клику на Title грида(кнопку,выбрать из списка,….)

                    И так пробовал через IndexDefs на уровне проектирования создавал.
                    (при этом по идеи чуть ниже список с индексами таблицы (IndexName) если я добавил то они должны били там появится а их там нету :((( )

                    При попытке выбрать индекс через Table1.IndexName:=’NAZ’; пишет

                    Цитата

                    Table1: index does not exist index: NAZ

                    :wacko:

                    Я так понял что надо создать индексный файл. Как это сделать? И после добавления записей его надо обновлять.

                    Сообщение отредактировано: neznayka — 14.06.05, 14:19

                    Wizard

                    Bas



                    Сообщ.
                    #9

                    ,
                    14.06.05, 14:38

                      Цитата neznayka @ 14.06.05, 14:16

                      Я так понял что надо создать индексный файл.

                      :yes:

                      ExpandedWrap disabled

                        create index

                      Цитата neznayka @ 14.06.05, 14:16

                      И после добавления записей его надо обновлять.

                      Cтруктурные индексы (MDX) всегда подключенны к базе и при изменении записей — обновляються автоматически.


                      Anatoly Podgoretsky



                      Сообщ.
                      #10

                      ,
                      14.06.05, 15:23

                        Никаких IndexDefs не надо, индексы создаются один раз, например с помощью Database Desktop и потом просто используются, путем указания в IndexName


                        neznayka



                        Сообщ.
                        #11

                        ,
                        14.06.05, 17:06

                          :) Большое всем спасибо!!! :)

                          ТЕМА ЗАКРЫТА :'(

                          0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

                          0 пользователей:

                          • Предыдущая тема
                          • Delphi: Базы данных
                          • Следующая тема

                          Рейтинг@Mail.ru

                          [ Script execution time: 0,0449 ]   [ 16 queries used ]   [ Generated: 13.06.23, 13:27 GMT ]  

                          Понравилась статья? Поделить с друзьями:
                        • Ошибка no hdds with s m a r t
                        • Ошибка no hard disk is detected
                        • Ошибка no game dll files
                        • Ошибка no function definition vlax get acad object
                        • Ошибка no function definition vlax ename vla object